On a page I have added a content editor with text that has display none. How can I make the text with display:none searchable with SharePoint search?
To make hidden text from Content Editor Web Parts show up in search results, you need to use internal or external styling, not inline styles on the text itself.
The text below will be shown in search results:
<style>
.hidden { display: none; }
</style>
<p class="hidden">This text will be indexed by the search engine.</p>
This text, however, will not be shown in search results:
<p style="display: none">This text will not be indexed by the search engine.</p>
In addition, you need to update the Search and Offline Availability settings for your site to make sure the web part is actually indexed. To do this, go to Site Settings and look under the Search category, then click Search and Offline Availability. On the following page, you need to set Indexing ASPX Page Content to Always index all Web Parts on this site. Please read the description for that setting to be aware of the potential side effects, though.
I found this solution here. I have tested it on SharePoint 2013 and can confirm that it works.
Related
I am very new to SharePoint. I want to create a web part that has an image in the background. For this, I went to insert at the top of the SharePoint page. Below is the image:
I want to insert the image first from the list of parts available in the web part and then I want to select application list so that application list can come on the top of the image. How can I achieve that? or is it possible to put the image first and then put a list on top of it.
any help will be highly appreciated.
You could add custom background image to the list view webpart zone.
Sample demo:
Insert a Content/Script Editor Web Part into the page and insert this code snippet into Web Part.
<style type="text/css">
#MSOZoneCell_WebPartWPQ2{
background-image:url(‘Your image url’);
}
</style>
Find the zone id #MSOZoneCell_WebPartWPQ2 by developer tool.
As you can see in the image below, when the InfoPath web part is placed on the SharePoint page (SharePoint 2013), it moves the page content area of the center.
This has happened on multiple pages. I can't seem to find any information about why this is happening.
Any help would be appreciated.
This is somehow a bug in SharePoint 2013 (check here). A quick resolution would be to add the following CSS to the page (in a hidden Content Editor WebPart or a Script Editor WebPart):
#sideNavBox {
display: none;
}
Paste this code in a script editor web part. Where it says WPQ2 change the 2 to the number of that webpart. You can find that by using Google Chrome inspect element. Modify the margins css to your liking.
<style type="text/css">
#MSOZoneCell_WebPartWPQ2 {
margin-left:-200px;
margin-top:-150px; }
</style>
This question regards website programming. My primary languages are c++/c# and I don't know much about web development, except that say I understand html and css. That's why I'm looking for a relatively simple solution, preferably something out of the box. I don't have any experience with JavaScript, but for the sake of this project I'm willing to learn it if necessary.
Let's say I have a database, where each entry is about a book. It contains the fields: title, author(s) and publication date.
I would like to create a simple website with a search box that has this dynamic result feature, so that you get suggestions after you type in a few letters. All those suggestions, as well as search results, need to be based purely on the database.
This could be a static website or based on any Content Management System, I'm familiar with Joomla, but was unable to find an out-of-the box component that would do just that. All those search modules search the entire website and I only need to search the database.
Probably I can help you with how to implement this feature. We used to call this feature as autocomplete menu.
First you decide minimum characters to populate autocomplete menu. For example 2
By using javascript you write keyup event. Once the characters count reaches to the minimum character count. You send AJAX request to the server.
The server should process this request and do the database search and form a json or xml response or plain text to the client.
The client parses that response into javascript object and construct a dynamic html for autocomplete menu with the data and render it into the DOM hence display's just below the search text box.
Now if you want to display the first result inside the textbox as you type. Here is the method I can suggest as similar as google search box
Place one label or span just below the input text box. By using css make its position exactly match with the position of the text box. Make sure the starting of text of both input text and label matches. Make the text color of the label less brighter than the font color of text. The font size and font family of the label should match the input text field's style. Now by using Javascript display the first or most matched text inside the label. Please find the sample code below
<!DOCTYPE html>
<head>
<style>
label {
position:relative;
}
body, input {
font-family: 'verdana';
font-size: 12px;
}
</style>
</head>
<html>
<body>
<form action="demo_form.asp">
<input type="text" name="fname" placeholder="Matched Text" /><br>
<label> Matched Text</label><br>
</form>
</body>
</html>
I have a code that creates a teamsite. After that I add some web parts to wiki web part zone(rich content area). In SharePoint 2010 user can change a text layout of the rich content in page edit mode.
Is there any way to programmatically change the text layout of the rich text area? I would want to set "two columns with header"-layout after site creation has completed.
My site is created like this.
site = elevatedSite.SelfServiceCreateSite(params.....);
rootWeb = site.RootWeb;
rootWeb.ApplyWebTemplate("STS#0");
SPListItem currentItem = rootWeb.Item;
var xhtml = currentItem[SPBuiltInFieldId.WikiField] as string;
Now I can modify the xhtml string and save it back to the page. I have tried to change it so that it contains exatly the same html structure which have created by sharepoint itself, when changing the text layout. After that change, actually it is not recognized as "two columns with header"-layout in sharepoint. It is still default one-column layout. Is there anybody who knows is it possible to change the text layout of the rich text area programmatically?
I found answer from here http://donalconlon.wordpress.com/2010/05/04/sp2010-creating-a-wiki-page-using-the-om/. SharePoint stores the information about used layout to the hidden span-element in wiki page.
For example, this presents two column layout without the header or footer.
<span id="layoutsData" style="display: none">false,false,2</span>
first false = no header
second false = no footer
2 = two columns
I have been looking for some information on doing the same thing. I found this blog post that checks out the page, edits the content then publish and approves it.
SharePoint 2010 change page content data through Object Model / API – Console Application
If you need to modify pure HTML content, its better to use cutom IHttpHandler (wrapped in dll) and connect it to SharePoint via web.config. Is is also allowing to modify dynamic content like AJAX responses.
When a list item has an attachment, SharePoint automatically renders a paperclip image for that particular row, which indicates that the item has an attachment. Is there any way to change the image that is rendered?
The site is in a shared hosting environment, so I can't simply replace the image on the file system. Also, there are other lists that are part of the same site that should use the default image.
Is there any way to change the image that is rendered for items with an attachment on an individual list basis?
EDIT: Following is the HTML that is rendered:
<td class="ms-vb2">
<img align="absbottom" src="http://devsandbox/_layouts/images/attach.gif" alt="Attachment"/>
</td>
The only real way you'll be able to do this is to use jQuery (or some other javascript library). You'll need to locate the elements you want to update on the page and change the URL's
$('img[src*=attach.gif]').each(function() {
$(this).attr('src', '/path/to/new/image.png');
}
My jQuery may be a touch wrong but that should be near enough to give you an idea of what to do
Edit - The best way to have this down would be via a custom WebPart which renders the JavaScript. This way it can easily be dropped into any page you want
i don't know which element off the top, but I would look for it in one of the stylesheets and use SharePoint designer to do the replacement work for a specific list.
Use Firebug to inspect the element that you want to revert. This will tell you the css class and other properties used by that element. Then write your own class and add it to the core.css file or if you want, add it to the css for the Site/Site Collection through the MasterPages link in Site Settings.
EDIT
I used firebug to look at an image in SharePoint and here is how it is rendering.
<img id="img_1-2_" class="rpo-gif rpo-gif-2" border="0" style="padding: 0px;" alt="Expand/Collapse" src="/_layouts/images/minus.gif"/>
As you can see it is using a class and setting a src to '/_layouts/images/minus.gif'. Well you can go find that file in the 12Hive directory and then replace it with an image of your choice that has the same name.