diff options
author | Silvano Cerza <silvanocerza@gmail.com> | 2021-04-16 17:45:25 +0300 |
---|---|---|
committer | Silvano Cerza <silvanocerza@gmail.com> | 2021-04-16 17:45:27 +0300 |
commit | 4faf3de5540dc3f7ecfcd1463e015cfe73492967 (patch) | |
tree | 3705a2aad4312d3b31db35c52d3450c0c627bbe5 | |
parent | 50558ed9bb03d3d8e84ddcb1b76b8f582e388308 (diff) |
Add canonical URL link in header.html
By default the page permalink is used, if necessary a custom
canonicalUrl parameter can be set in a page front matter.
-rw-r--r-- | layouts/partials/header.html | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 4d918e1..2c7cfad 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,5 +1,10 @@ <head> <link href="https://gmpg.org/xfn/11" rel="profile"> + {{ if .Params.canonicalUrl }} + <link rel="canonical" href="{{ .Params.canonicalUrl }}"> + {{ else }} + <link rel="canonical" href="{{ .Permalink }}"> + {{ end }} {{ partial "header/meta.html" . }} {{ partial "header/styles.html" . }} {{ `<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> |