Skip to content

Prevent Duplicate Content

Phillip Haydon edited this page Oct 3, 2013 · 6 revisions

Mehdi Khalili raised an issue about duplicate content with Snow.

For example:

  1. http://www.philliphaydon.com/2013/09/instant-nancy-web-development-book-review/index.html
  2. http://www.philliphaydon.com/2013/09/instant-nancy-web-development-book-review/

These two URLs are technically two different pages to a Search engine. This occurs because in order to handle static content with Extensionless URLs, we create a directory to put an index file in.

To prevent Google or other search engines from thinking of them as two different URLs, you can add a canonical header to your HTML markup to tell the search engine what the URL is.

<head>
  @Html.CanonicalUrl()
</head>

This would output a URL like:

<head>
  <link rel="canonical" 
        href="http://www.philliphaydon.com/2013/09/instant-nancy-web-development-book-review/" />
</html>

This will mean the index.html and the default document url will be treated as the same resource.