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.
This commit is contained in:
Silvano Cerza 2021-04-16 16:45:25 +02:00
parent 50558ed9bb
commit 4faf3de554

View file

@ -1,5 +1,10 @@
<head> <head>
<link href="https://gmpg.org/xfn/11" rel="profile"> <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/meta.html" . }}
{{ partial "header/styles.html" . }} {{ partial "header/styles.html" . }}
{{ `<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> {{ `<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->