Working with SEO in Sitecore

45 min read

Published:

In this post I will start to describe some of the topics surrounding SEO (Search Engine Optimization) and how that correlates to development in Sitecore. There will be plenty more articles on this topic on my blog, but this will be the introduction to the topic and to give common tactics that can help SEO when either building your first site from scratch in Sitecore or redeveloping an existing site and transferring it to Sitecore.

What’s different about Sitecore over existing CMS platforms, is that it’s a mostly custom framework, everything you do with it, comes from the development perspective, and depending on the development team you are working with, they might not have a focus on the SEO and even the online marketing aspects that I think are vital for online marketing of a traditional website.

Most on this blog, are probably not aware, but I began my career in development, by working for a company that was focused on Online Marketing, primarily thru Search Engine Optimization. I didn’t discover Sitecore till years later, which probably has helped me build more complete marketing platforms on Sitecore. It’s important to build Sitecore in a way that will support SEO efforts.

Duplicate Content

When working with Sitecore, being aware of duplicate content is probably more important in this CMS than in other content management systems, because Sitecore provides each item in a variety of different url formats. For example, the homepage url, could display in any of the following urls:

Now if you are being consistent with your links, you are probably less likely to run into a duplicate content issue, because Google will only index pages it finds. However if you slip and include a url to something else than the rest of your site does, you are opening the door for Google to index two versions of the same page.

There are ways to fix this however with this Sitecore. I’ve already mentioned one method previously, and that is to always be consistent with which url format you are using. You can help this by patching the Link Manager in the configuration to create url’s for your site in the format you need them to be. Below is an example patch configuration that I’d recommend if you have a site that doesn’t have multiple language versions running from it.

1<?xml version="1.0"?> 2<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> 3 <sitecore> 4 <linkManager> 5 <patch:attribute name="defaultProvider">custom</patch:attribute> 6 <providers> 7 <clear /> 8 <add name="custom" type="Site.Infrastructure.Managers.LinkManager, Site.Infrastructure" addAspxExtension="false" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="never" languageLocation="filePath" shortenUrls="true" useDisplayName="false" /> 9 </providers> 10 </linkManager> 11 </sitecore> 12</configuration>

So this patch file definition defines a custom configuration, one where you can extend it further in that included assembly. But it defines that when a link is generated for an item in Sitecore, that it will use a short URL (instead of the full item path), it will not include language codes and will not include the aspx extension. There’s a few other settings there, most of those you’ll find set in the defaultProvider that comes with Sitecore.

I’d say that configuring that is half of the battle of preventing duplicate content, the second half is about preventing and instructing Google if it ever does find a page on your site that isn’t based on this default Link Manager URL that you defined above. For example, if you have defined the Link Manager exactly the same way I did above, but Google or another search engine ended up on another URL that isn’t that default one, that you would want Google to know which is the correct version. There is two ways you could do this, the first is to 301 the different urls into this default URL provided by the link manager. The second is to setup a Canonical tag for the search engines to interpret. If someone ends up on http://www.website.com/home, and the default url is http://www.website.com, then you would show a canonical tag in your header letting the search engine know which URL is the correct page for the current page. (https://support.google.com/webmasters/answer/139066?hl=en)

To setup canonical tag logic in Sitecore, you can simply build a controller action (assuming you are using Sitecore MVC) that just renders on the layout of your pages in the head tag. You could write it so that if the current context url matches the one generated by the Link Manager, then you don’t need a canonical tag with URL specified. If it doesn’t match however you can display it, and it can include the URL of the Link manager URL for the current context item.

Meta Tags

When we are building Sitecore sites, generally there will be items in the content tree that represent pages on the site. These will typically have layout and renderings specified. An example would be a Home item. For these items that represent pages, you should create fields that store meta tag information for the page. I typically create a Base Page item that can be inherited by Templates that will become “pages” on the site. So for example, when I’m defining the “Home” template, I will inherit from the Base Page template item. This template includes fields for all the meta tag information you will need to display on the site. Typically you will need Meta Title and Meta Description, and in some cases Meta Keywords. Once these are defined, similar to the canonical tag, I will have a controller action that pulls these tags out on the layout. I typically create a Page Controller, that handles common page level elements such as meta tags, canonical tags and other optimization tag logic.

Schema Tags

Schema tags are not necessarily going to help you improve your rankings, but will help search engines understand the content on your website. You can read more about Schema tags and what types of data they format by going to SEO Moz. You can add schema tags to all types of data, include business listings, books and production information.

Page Optimization

Page optimization mostly focuses on ways you can increase page speed which actually impacts how your site ranks. No one likes going to a site that takes forever to load. You should first and foremost ensure your site responds quickly from the first request to the response the server gives back. These performance enhancements rely that you’ve done proper things while developing your site in Sitecore. Avoiding recursive queries in your Sitecore trees and using different variations of Sitecore caching can help your code base return results quickly back to the client. Once that is setup and you are getting back results quickly, the next thing to consider is how well the client responds after it receives a response.

To help improve performance on the client, you can reduce the number of requests the client is making to pull resources. You can do this by using Sprites to combine buttons and icons into one single request, and then allow CSS to pull specific image elements into the page when needed. Also in .net you can reduce the amount of requests by bundling and minifying scripts and CSS resources into your webpage. You should combine all your site scripts into one bundle, which when not in debug mode, will generate one combined script include that will be minified for performance.

Also you should try to reduce the size of the images on the site. Often times, a content editor will upload images too large, either being they haven’t optimized the image or that they are uploading images with a height and width much large than what they really need. Before uploading images to the Media Library, you should make sure you’ve optimized the images, you can do this by using popular sites like tinyPNG and tinyJpeg, but there are many other types of sites out there that can help you reduce the size of the images, which will improve page load speeds. Also there is a new trend to use SVG images which are drastically smaller than .jpg’s and .png’s. However these types of images are quite complete and generally should be left to a front-end web developer to place them.

Image Alternate Tags

This is a fairly common topic in SEO, and something that Sitecore makes very easy to support. Media items found in the Media Library of Sitecore, should have the support for “Alt” tags, by completing the Alt tags field. Sitecore even goes a step further by making this field a required field. Lastly by using the Helper methods for when you are trying to display an image from Sitecore, when it builds the image tag, it will automatically pull the alt tag information and populate this part of the image tag.

Mobile Friendly

Most would be surprised to learn that having a mobile friendly website helps your site rankings. Recently Google made a major shift, as it’s percentages of Mobile searches increased, it decided that it would rank mobile friendly websites higher than non-mobile friendly sites. It’s reasoning being that users on mobile devices would have a better overall user experience because the sites that were shown higher on it’s results were going to support those on mobile devices better. So this is why it’s important to make sure the sites you’ve built are mobile friendly. Luckily this is not a new concept, and even if you are just building sites to work in different devices instead of building a responsive website, you are on the right track in this regard.

Ajax Functionality

When working a lot with Ajax, it’s important that you make sure Google can comprehend the changes occurring on the page. An example would be if you had an ajax functionality occurring when you do pagination on a grid. As more items load, you should include ways that Google or other search engines can ready these changes on the page. Some good methods to allow search engines to see the pages are included here.

That pretty much concludes this topic, there will be more topics surrounding SEO and Sitecore on my blog in the future. I also will probably include just general SEO topics, just so those that aren’t aware of how to do SEO, can learn and help build better sites using Sitecore. Since Sitecore is a platform that requires the developer to build the infrastructure for the site, it’s very important that they understand basic on page Search Engine techniques.

General

Home
About

Stay up to date


© 2024 All rights reserved.