Creating an SEO Page Title

We needed to change all of our page titles to optimize them for the search engines (SEO) but we used the page titles in all of our site navigation and we didn’t want the SEO title used in our navigation. Here’s a fairly simple solution but you have to implement it very carefully because it’s really easy to bring your entire site down with one master page publish.

The overall solution is to add a new field to your pages and then tell your master pages to use that new field for the page title. Before you start this process you should 1. Make a list of all of the master pages that will use this new field and 2. Make a list of all of the page layouts that are used by those master pages. You will be modifying all of them!

Steps

  1. Create a new site column called SEOPageTitle
  2. Add the column to your document content type(s)
  3. Change the field where the master page is pulling the page title
     <title><asp:ContentPlaceHolder id=”PlaceHolderSEOPageTitle” runat=”server”/></title>
  4. Move the default page title placeholder to a hidden ContentPlaceHolder control
    Look for this      <asp:panel visible=”false” runat=”server”>
    Add this after it      <asp:ContentPlaceHolder id=”PlaceHolderPageTitle” runat=”server”/>
  5. Check-in the master pages and make sure nothing breaks 🙂
  6. Add a placeholder control to all of the page layouts that will be accessed by the master pages. We added this just above the PageTitle ContentPlaceHolder.
    <asp:Content ContentPlaceholderID=”PlaceHolderSEOPageTitle” runat=”server”>
     <SharePointWebControls:FieldValue id=”SEOPageTitleID” FieldName=”SEOPageTitle” runat=”server”/>
    </asp:Content>
  7. Check-in all of your page layouts

That should be it. If you did everything in the correct order, your site never went down. Just a warning… We had a lot of “strange” errors while we were making these changes. We seemed to get different results on test and production at times, so good luck… 🙂

Now you just need to update all of the pages with a new SEO title

Advertisements