I had a momentary heart attack today when all of the links to my blog posts from my default.aspx home page were linking to the main site level of the blog.
After resetting the blog to the site definition and noticing the problem still existed, I came across this article which helped me figure out the problem. The Blog Tools web part on my page was throwing an error (for some reason), and apparently when that web part isn't on your page and functioning correctly, none of the links work.
Strange, but at least it's fixed. Heart attack prevented.
Thursday, August 27, 2015
Wednesday, August 26, 2015
How to add the note board web part to your page layout
The situation: I'm creating a site with internal news articles, and the customer would like for people to leave comments on each one.
The problem: I tried going into SharePoint Designer and adding the web part through the interface, but then got the "sorry, I don't understand that tag" message.
The solution: It's always a matter of figuring out the proper include for the top of the page, isn't it? Here's what I did:
The problem: I tried going into SharePoint Designer and adding the web part through the interface, but then got the "sorry, I don't understand that tag" message.
The solution: It's always a matter of figuring out the proper include for the top of the page, isn't it? Here's what I did:
- Add the note board web part code into the page layout:
<SharePointPortalControls:SocialCommentWebPart id="noteboard" ChromeType="None" runat="server" /> - Add the SharePointPortalControls include to the header of my page layout:
<%@ Register TagPrefix="SharePointPortalControls" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
Friday, August 21, 2015
Adding Content Query Web Part to a master page
The situation: I'm trying to create a footer for my site which dynamically displays recent news articles, blog posts, and videos.
The problem: I'm having issues with both the Data View and adding my exported Content Query web part to my master page. The CQWP is giving me an error message that the WebControls:ContentByQueryWebPart isn't cool, and the Data View is not filtering as I expect, and those stupid column headers are killing me. I read somewhere that you shouldn't put CQWP on a master page, but I'm going to do it anyway.
The solution: After piecing together several articles (mostly about SharePoint 2010), I was able to make my content query solution work:
The problem: I'm having issues with both the Data View and adding my exported Content Query web part to my master page. The CQWP is giving me an error message that the WebControls:ContentByQueryWebPart isn't cool, and the Data View is not filtering as I expect, and those stupid column headers are killing me. I read somewhere that you shouldn't put CQWP on a master page, but I'm going to do it anyway.
The solution: After piecing together several articles (mostly about SharePoint 2010), I was able to make my content query solution work:
- Create a test page. Add a Content Query web part.
- Configure it to show what you need. Give it a useful name and hide the chrome.
- Export the web part. Save it to the site collection web part gallery.
- Open the master page in SharePoint Designer. (This is where I discovered that you have to hit Code View Tools > Parse HTML to be able to add any web part or code view to your page. Every. Time.)
- Add these to the top of the master page:
<%@Register Tagprefix="Publishing" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
<%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> - Insert tab > Web Part > find your exported CQWP > click on it.
- SPD will insert your web part with this tag: <WebControls:ContentByQueryWebPart>. This is what will create the error on your pages. I added Publishing before WebControls in the opening & closing tags: <PublishingWebControls:ContentByQueryWebPart>. All better.
- Save. Publish.
Tuesday, August 18, 2015
How to do a partial bottom border on your navigation items
The situation: I'm creating a SharePoint site based on a design from a graphic designer. The design included active/hover properties for the top navigation which included a partial bottom border.
The problem: I was hoping to just use border-bottom to style the hover & active navigation, but that was creating extra-long lines which included the padding for that div.
The solution: After piecing together a few different posts and suggestions, this is what worked: I had to find the style(s) that controlled the hover & selected/active navigation items. I copied the names of the classes, and pasted them at the end of my CSS, and then gave them the following properties:
#MenuH ul.root>li>ul>li.selected>.menu-item .menu-item-text:after {
height:2px;
background:#FFC836;
width:75%;
display:block;
margin:0px auto;
content:"";
}
Note that my style had a comma-separate list of several different classes. I added ":after" just before each comma, at the end of only the last part of the style, as above.
The result: Happy clients, and this:
The problem: I was hoping to just use border-bottom to style the hover & active navigation, but that was creating extra-long lines which included the padding for that div.
The solution: After piecing together a few different posts and suggestions, this is what worked: I had to find the style(s) that controlled the hover & selected/active navigation items. I copied the names of the classes, and pasted them at the end of my CSS, and then gave them the following properties:
#MenuH ul.root>li>ul>li.selected>.menu-item .menu-item-text:after {
height:2px;
background:#FFC836;
width:75%;
display:block;
margin:0px auto;
content:"";
}
Note that my style had a comma-separate list of several different classes. I added ":after" just before each comma, at the end of only the last part of the style, as above.
The result: Happy clients, and this:
Wednesday, August 12, 2015
Making the SharePoint blog full width
The situation: I have a team site template with the publishing feature activated. It has a custom design, which includes master page & page layouts. It has to include a blog.
The problem: After creating the blog, I realized that the content of the page only goes about two-thirds of the way across, with no way to update that while editing the page.
The solution: After a little poking around, I found the three styles that had to be updated to extend the blog posts to expand the full width of the page.
I added the following styles to my COREV15.css:
.ms-blog-MainArea {max-width:none;}
.ms-blog-postList {max-width:none;}
.ms-blog-MainArea>tbody>tr>td{width:100%;}
The two max-width styles were already listed, with a setting of 860px and 670px, respectively. I found those and replaced them with none instead of adding a second style.
I'm sure there are different and possibly better ways to do this, but it took care of what I needed. The end result:
The problem: After creating the blog, I realized that the content of the page only goes about two-thirds of the way across, with no way to update that while editing the page.
The solution: After a little poking around, I found the three styles that had to be updated to extend the blog posts to expand the full width of the page.
I added the following styles to my COREV15.css:
.ms-blog-MainArea {max-width:none;}
.ms-blog-postList {max-width:none;}
.ms-blog-MainArea>tbody>tr>td{width:100%;}
The two max-width styles were already listed, with a setting of 860px and 670px, respectively. I found those and replaced them with none instead of adding a second style.
I'm sure there are different and possibly better ways to do this, but it took care of what I needed. The end result:
Tuesday, August 4, 2015
SharePoint errors: content controls x3
Normally I get frustrated by the unhelpful SharePoint error messages. Today's made me laugh:
I feel like I need to give my error message a recursive error.
Tuesday, July 28, 2015
Tired of hiding the chrome on your content editor web part?
The situation: I'm lazy efficient.
The problem: When building a web part page, it gets very tiresome to always have to go into web part properties and change the Chrome to "None" so that the title and border don't show when I just want to publish web content. I wish I could change the default option for all web parts to no chrome, because honestly, I'm usually creating my own content editor web parts to make the headings pretty anyway.
The solution: Create a new custom web part for your site which has the chrome already set to None. Each new instance of the web part will be ready to go, so you won't have to edit the web part properties every. single. time.
Access level: To do this the recommended way, you should be a site owner for the site collection.
The problem: When building a web part page, it gets very tiresome to always have to go into web part properties and change the Chrome to "None" so that the title and border don't show when I just want to publish web content. I wish I could change the default option for all web parts to no chrome, because honestly, I'm usually creating my own content editor web parts to make the headings pretty anyway.
The solution: Create a new custom web part for your site which has the chrome already set to None. Each new instance of the web part will be ready to go, so you won't have to edit the web part properties every. single. time.
Access level: To do this the recommended way, you should be a site owner for the site collection.
- Go to a your web part page. Click Add a Web Part (in any zone, it doesn't matter). Select Media and Content > Content Editor. Click the Add button.
- Click on the drop-down arrow on the right side of your web part title, and select Edit Web Part.
- In your Content Editor web part properties, expand the Appearance section, and change the Chrome Type to None. Click the OK button to save your changes.
Ahh! The chrome is still there! Don't worry, you'll always see the chrome in Edit mode. Once you save the page, it will be hidden.
- Now you're going to export the web part you just created by clicking on the drop-down arrow next to the web part title, and selecting Export.
- You might get the following pop-up - click on OK twice.
- You should now get a prompt to save your .dwp web part file. Save it and remember where you put it.
- Navigate to the Site Settings for your site collection. (Gear icon in upper right > Site Settings. If you're not at the top of the site collection, click on the link "Go to top level site settings" under Site Collection Administration. If you don't have access there, request it or ask your site collection administrator to do this part for you.)
- Under the Web Designer Galleries section, click on Web Parts. Click on the Files tab in the ribbon > Upload Document. Browse to find the file you saved in step 6. Click OK.
- Give your content editor web part a name and title that you'll remember (and that will distinguish it from the out-of-the-box Content Editor web part), and create a new category for your web part so that you can find it quickly. Click Save.
- Navigate back to your page. Click on Add a Web Part in any zone. Find the category you created in step 9, and click on the name of your web part. Click the Add button.
- Add some content and Save your page. You will see your content presented without the web part chrome.
You will be able to use this custom web part throughout your site collection. Take it a step further - if you have similar types of content that you add via content editor web parts, you can create additional custom content editors which give you a good starting point (and can help your other content contributors).
Friday, July 24, 2015
How to append the current site path to your search query
The situation: I had to add product and people search blocks to the search experience in my site collection. Since the osssearchresults.aspx page cannot be edited, I created a new search results page. I set the page query to only return results from my site collection. Once I had everything configured, a change request came in to only have results returned from the hierarchy where the search originated.
The problem: Since my search results page sat at the top of the site collection, I needed some way to pass the path where the search was performed to the results page. I noticed that there was a parameter of u=[path] that seemed to appear frequently as I was navigating around my SharePoint sites, but I couldn't figure out how to append that to my URL as the search was sent. I tried /.../Pages/Search-Results.aspx&u={lots_of_wrong_tokens}, but couldn't get anything to convert into the actual path.
The solution: After spending a lot of time researching with no luck, I noticed while editing the Search Box web part that there was an option to direct the queries to a Results Page URL of "~site/_layouts/15/osssearchresults.aspx?u={contexturl}" instead of sending to the search results web part on the page. I appended "?u={contexturl} to the end of my search results page path on the Search Settings page, and like magic, that token converted into the path where the search originated.
I modified my Search Results web part query to "{searchboxquery} Path:{QueryString.u}", and my results page was only returning results from the hierarchy where the search was performed.
Possible issues: Visiting the search results page without a query used to return all results; now it shows no matches. This isn't a huge deal, but not having the u=[path] in the URL leads to an empty search, and if there is a keyword parameter but no path, you see ye olde "something went wrong" message.
My failed searches: "send queries to custom results page URL", "sharepoint 2013 append something to search query", "sharepoint 2013 how to append something to the search query automatically", "sharepoint 2013 master page append text to search query" (yes, I was getting desperate!), "sharepoint 2013 using a custom search results page", "SharePoint 2013 how to edit osssearchresults.aspx", "SearchSmallInputBox", "add source to SharePoint 2013 search", "append path to search query URL", "SharePoint 2013 search default page add u=", "sharepoint 2013 search only this site", "SharePoint append path to search string", "sharepoint add path property to URL"
The problem: Since my search results page sat at the top of the site collection, I needed some way to pass the path where the search was performed to the results page. I noticed that there was a parameter of u=[path] that seemed to appear frequently as I was navigating around my SharePoint sites, but I couldn't figure out how to append that to my URL as the search was sent. I tried /.../Pages/Search-Results.aspx&u={lots_of_wrong_tokens}, but couldn't get anything to convert into the actual path.
The solution: After spending a lot of time researching with no luck, I noticed while editing the Search Box web part that there was an option to direct the queries to a Results Page URL of "~site/_layouts/15/osssearchresults.aspx?u={contexturl}" instead of sending to the search results web part on the page. I appended "?u={contexturl} to the end of my search results page path on the Search Settings page, and like magic, that token converted into the path where the search originated.
I modified my Search Results web part query to "{searchboxquery} Path:{QueryString.u}", and my results page was only returning results from the hierarchy where the search was performed.
Possible issues: Visiting the search results page without a query used to return all results; now it shows no matches. This isn't a huge deal, but not having the u=[path] in the URL leads to an empty search, and if there is a keyword parameter but no path, you see ye olde "something went wrong" message.
My failed searches: "send queries to custom results page URL", "sharepoint 2013 append something to search query", "sharepoint 2013 how to append something to the search query automatically", "sharepoint 2013 master page append text to search query" (yes, I was getting desperate!), "sharepoint 2013 using a custom search results page", "SharePoint 2013 how to edit osssearchresults.aspx", "SearchSmallInputBox", "add source to SharePoint 2013 search", "append path to search query URL", "SharePoint 2013 search default page add u=", "sharepoint 2013 search only this site", "SharePoint append path to search string", "sharepoint add path property to URL"
Subscribe to:
Posts (Atom)