Sitecore SEO

The Labyrinth

SEO is a wooly subject and I don't pretend to be an expert. What I can speak to is my experience of auditing and improving clients' Sitecore sites to perform better in search engines, and the lessons learned in that often labyrinthine process. In this post I'll discuss the aspects of SEO I'd deem most relevant to Sitecore developers and marketeers in 2018.

All About the Content

The rest of this post can basically be ignored if this first item isn't adhered to. Your site's content has to be tip-top. Search engines are so good at parsing HTML and making sense of your content that they no longer need to rely upon the 'signposting' that metadata provides. Professional, topic-focused content with deliberate use and repetition of key phrases and words to guide crawlers will do more to boost your site's performance than any amount of metadata tags or sitemaps.

Make your titles clear. Search engines are looking at the HTML to make sense of the page. An H1 tag tells them what the page is about, while other headings indicate content structure and topics. Think about organic search when you create your content. How do you want your personas to land on this page? Write content that your personas will want to read (you did do a persona study, right?). List the author against the article where you can.

Make the site trustworthy by reducing bounce rate, enforcing HTTPS across all pages and encouraging shares and links to your pages. Above all, remember that with modern search engines context is now king. Mainly after Google's RankBrain update in 2015 (and similar updates in other engines), longer, contextual keyword searches are much more effective and commonplace. Match that with your content. Have collections of longer phrases used for topics in your content and include them wherever they best fit.

Keep it consistent

For a Sitecore site, it is important to enforce consistent URL policy with the content team. Discover what your ideal URL structure is and stick to it. If you need to modify characters, look at the encodeNameReplacements section of the sitecore.config file.

<encodeNameReplacements>
  <replace mode="on" find="&amp;" replaceWith=",-a-," />
  <replace mode="on" find="?" replaceWith=",-q-," />
  <replace mode="on" find="/" replaceWith=",-s-," />
  <replace mode="on" find="*" replaceWith=",-w-," />
  <replace mode="on" find="." replaceWith=",-d-," />
  <replace mode="on" find=":" replaceWith=",-c-," />
</encodeNameReplacements> 
Sitecore Aliases

Avoid Sitecore Aliases if you're thinking about using them for SEO purposes as vanity URLs. This has been discussed a lot already but generally speaking, they will bamboozle crawlers into thinking two pages exist and give you a lot of headaches. Use a Redirect/Rewrite Module instead. There are plenty of good ones out there, or you could always roll your own.

Metadata - the classics

Metadata tags really don't have the SEO clout they used to, but while they may not affect your rankings so much, where they really shine is in decorating your search results to make them more appealing to a user wherever your site is featured, be it in Google, on Twitter, Linkedin, etc.

Keywords..?

Meta keywords aren't really necessary in 2018. At best, they'll have a neglible impact on your rankings. At worst, they'll encourage engines to devalue your pages where the keywords clash with the engine's understanding of your content. If you do use them, employ longer, meaningful phrases that exist in the body of your page already.

Title & Description

The <title></title> tag is still king. Use this to help guide search engines naming your content. The meta description is oft-talked about as the need for it has declined a lot. Again, search engines are quite capable of accurately determining and summarizing the content of your page without it. However, a well-written description is indicative of a thoughtfully presented website, so provided you use unique and well-composed prose (Google tends to penalise duplicate descriptions) it may have positive effect on your rankings. The ideal length of a meta description has shifted from 155 characeters to ~300 after Google's Snippet Length increase release in November 2017. This has been corroborated by a number of recent studies.

A traditional Sitecore Metadata base template might look something like this:

Pretty basic right? Just wait.

Pointers for Crawlers

It's usually a good idea to include a Canonical meta in your HTML head too:

<link rel="canonical" href="https://www.sitecorgi.net" />

This simple link tells crawlers like Googlebot the single point of truth for this page, in case for whatever reason it is duplicated.

If you run a multilingual site then you really should be using Alternate meta in your HTML head as well:

<link rel="alternate" href="http://example.com/en-ie" hreflang="en-ie" />
<link rel="alternate" href="http://example.com/en-ca" hreflang="en-ca" />
<link rel="alternate" href="http://example.com/en-au" hreflang="en-au" />
<link rel="alternate" href="http://example.com/en" hreflang="en" />

Here, be sure to specify each of the language variants of that page (where the item has a version in that language). This will tell crawlers that equivalent content in the other languages specified exists at those pages.

It is also often useful, especially if you make use of a site-level language fallback and default language, to specify that using the following:

<link rel="alternate" href="http://example.com/" hreflang="x-default" />

Metadata - the new kids

More recent metadata tag innovation is primarily concerned with opening your site to other channels, with social media naturally being a major focus. They'll improve the look and feel of links and shares of your pages on social media and other platforms (e.g. apps). This is a major boon for SEO - increased volume of inbound traffic makes your site appear more trustworthy and authoritative to search engines. The two main types are Open Graph and Twitter Cards.

Open Graph Meta

It's worth perusing the Open Graph Protocol for the full range of meta tags that may be pertinent to your Sitecore site, especially if your site deals in varying types of media and/or ecommerce.

These are typically rendered like so:

<meta property="og:title" content="Sitecorgi" />
<meta property="og:description" content="Sitecore SEO" />
<meta property="og:url" content="https://www.sitecorgi.net" />
<meta property="og:image" content="/path/to/corgi.jpg" />

A succinct addition to our Sitecore Metadata base template might therefore look like this:

Twitter Cards

Twitter cards can improve the appearance of your pages on Twitter links and shares with imagery, video and other rich formatted content. They can be especially powerful if your content editors or organisation have Twitter accounts themselves. As twitter cards can vary from page to page in format, it can be useful to also give content editors the ability to alter the type of Twitter Card associated with the page.

These can be really quite rich, again especially if your site employs a lot of different media types.

These are rendered like this:

<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@sitecorgi">
<meta name="twitter:creator" content="@sitecorgi">
<meta name="twitter:title" content="Sitecore SEO">
<meta name="twitter:description" content=" In this post I'll discuss the aspects of SEO I'd deem most relevant to Sitecore developers and users in 2018.">
<meta name="twitter:image" content="/path/to/corgi.png">

Expanding our base template further now adds the following fields:

Our pages' metadata should now be much richer.

Structured Data

According to Google,

Structured data is a standardized format for providing information about a page and classifying the page content; for example, on a recipe page, what are the ingredients, the cooking time and temperature, the calories, and so on.

Providing this information allows the big engines like Google and Bing to format and present your search results in a much richer manner than before. Navigation elements, embedded videos, search bars, products - all of these can be made to appear in search results. As a Sitecore architect, a Business Analyst working on a Sitecore build or a marketeer looking to embrace the platform, consider your Information Architecture. What are the most important objects and artefacts that you want to tell Google about? Events, products, news articles, videos, guides, all of these and more can be candidates. For a while there have been a number of different ways to support Structured Data but rather than review them all I'm just going to recommend one based on my experience: JSON LD, a lightweight Linked Data format supported by the major players in representing Structured Data. It's particular advantage over rival formats stems from its separation of data and markup, making it easier to represent more nuanced objects. I highly recommend Moz's guide to the format for further reading, as well as Steal Our JSON-LD for help defining your structures

Take a look at this example of an organisation:

{
    "@context": "http://www.schema.org",
    "@id": "https://www.sitecorgi.net",
    "@type": "Organization",
    "name": "Sitecorgi",
    "description": "Occasional missives concerning Sitecore XP, .NET, Corgis and anything else."
}

Or this more specific one for an event:

<script type='application/ld+json'> 
{
  "@context": "http://www.schema.org",
  "@type": "Event",
  "name": "Fundraising Gala",
  "url": "http://www.example.com/gala",
  "description": "We're raising money for a good cause",
  "startDate": "07/04/2018 02:00PM",
  "endDate": "07/04/2018 11:00PM",
  "location": {
    "@type": "Place",
    "name": "The Ritz",
    "sameAs": "http://www.example.com",
    "address": {
      "@type": "PostalAddress",
      "streetAddress": "The High Street",
      "addressLocality": "London",
      "addressRegion": "Greater London",
      "postalCode": "N1 1LF",
      "addressCountry": "UK"
    }
  },
  "offers": {
    "@type": "Offer",
    "description": "an offer description",
    "url": "http://www.example.com",
    "price": "£9.99"
  }
}
 </script>

A well formatted event might look something like this Taylor Swift ad in Google:

My recommendation is to run with lightweight view renderings with caching enabled to output the data for minimal performance impact. As with any rendering, use a datasource where practical to drive your content and make it Experience Editable.

Accelerated Mobile Pages

I'm going to focus on Google A.M.P. here but these pointers could apply equally to any of the throng of 'web accelerators' that sprung up around 2015-16 in diverse channels, including Facebook Instant Articles and Apple News. AMP has been a divisive subject more or less since it launched, with its promise of faster, simpler mobile web pages with minimal JavaScript and concomitant improved bounce rate meeting resistance in the arguments around the risk of lock-in and inescapable proprietary technology. Nonetheless, many Sitecore sites may wish to make use of it to improve SEO for mobile search results and a measurable increase in time spent on the page.

I've implemented AMP on a number of Sitecore sites now and the format hasn't varied too much:

  1. Create a new device layout with the appropriate name and query path:
  2. Create a layout and set of components for the device using the AMP HTML specification
  3. Use standard values to ensure the device is present on your key content pages (typically news articles, press releases and blogs)
  4. Where possible, extend the Sitecore link provider and Item resolver pipeline to allow linking between AMP pages
  5. Add the amphtml link to your main device layout:
  6. Clean up your rich text. AMP's formatting is much more restrictive than regular HTML5, so requires care around complicated sections of HTML such as embedded video or iframes. This can be achieved through either maintaining two different RT fields for your content, or through programmatically altering the content on render. See this helpful SO post for a representative example of the latter.

Sitemaps galore

Submitting your Sitemap.xml is always a good thing to do. Nothing new there. Along with providing directional pointers in your robots.txt it can help the myriad search engine bots out there find their way through your content:

User-agent: *
Sitemap: http://www.sitecorgi.net/sitemap.xml

However, as a Marketeer you may be interested in making use of sitemaps for other types of content on your site, such as Video, News and Images. Simply maintaining a news-sitemap alongside your main Sitemap.xml will have a marked improvement in the performance of your site's news articles' rankings. They should also begin to appear under the relevant tabbed sections of your search engine. As with regular sitemap.xml, these are best generated dynamically by traversing your content and updating the sitemap with the latest items. I've seen a number of ways of rendering this out - from writing to physical XML files periodically, to pipelines, to HttpHandlers. Hopefully at a later date I'll dig deeper into the advantages and drawbacks to these approaches - my personal favourite is to write to actual XML files either on a cache clear or at intervals.

The format for a news sitemap is as follows:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
    xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">
  <url>
    <loc>http://www.sitecorgi.net/adventures-in-solr</loc>
    <news:news>
      <news:publication>
        <news:name>Sitecorgi</news:name>
        <news:language>en</news:language>
      </news:publication>
      <news:genres>PressRelease, Blog</news:genres>
      <news:publication_date>2018-03-13</news:publication_date>
      <news:title>Adventures in Solr</news:title>
      <news:keywords>solr, sitecore, solrnet</news:keywords>
    </news:news>
  </url>
</urlset>

SEO long, farewell

This has been a real whiste-stop tour out of necessity given the amount of content to cover! I hope at some stage to delve into some more in-depth examples as well as get more into the code for some of these but for now I hope that this provides you with an informative overview of things to consider SEO-wise when working with your Sitecore site.