Thursday, August 27, 2015

Why are all my SharePoint 2013 blog posts linking to the main blog URL?

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.

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:
  1. Add the note board web part code into the page layout:
    <SharePointPortalControls:SocialCommentWebPart id="noteboard" ChromeType="None" runat="server" />
  2. 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:

  1. Create a test page.  Add a Content Query web part.
  2. Configure it to show what you need.  Give it a useful name and hide the chrome.
  3. Export the web part.  Save it to the site collection web part gallery.
  4. 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.)
  5. 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" %>
  6. Insert tab > Web Part > find your exported CQWP > click on it.
  7. 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.
  8. 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:


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: