How to add cannonical URL to a blog?

This is how I do it:

  1. Copy your theme’s layouts/_default/baseof.html file into your own layouts/_default folder (most themes doesn’t touch baseof.html and use a different partial, so just follow the trail).

  2. Add this:

    {{ with .Params.relcanonical }}
      <link rel="canonical" href="{{ . | relLangURL }}" itemprop="url" />
    {{ else -}}
      <link rel="canonical" href="{{ .Permalink }}" itemprop="url" />
    {{ end -}}
  3. In your post frontmatter you can then add:

    relcanonical = ""

This is assuming that your theme did not provide its own rel=canonical. If it is already generating its own rel=canonical, you need to find it and remove it because search engines (especially goog) will ignore all rel=canonical if there is more than one per page.

Hope it helps.