head: add support for Canonical URLs

cc:  #104

usage =>
  in site config.yml (used for home page only) =>
     canonical: ["https://www.example.com" , "https://blog.example.com"]
  in per-page vars =>
     canonical: ["https://www.example.com/page1" , "https://blog.example.com/pages/page1"]
This commit is contained in:
Aditya Telange 2020-12-13 16:36:30 +05:30
parent b7f5dd10f1
commit 8af7c551ff
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77
1 changed files with 4 additions and 0 deletions

View File

@ -17,6 +17,10 @@
{{- with .Site.Params.description }}{{ . }}{{- end }}{{- end }}{{- end -}}"> {{- with .Site.Params.description }}{{ . }}{{- end }}{{- end }}{{- end -}}">
<meta name="author" content="{{ (partial "author.html" . ) }}"> <meta name="author" content="{{ (partial "author.html" . ) }}">
<link rel="canonical" href="{{ .Permalink }}" /> <link rel="canonical" href="{{ .Permalink }}" />
{{- $canonical := cond (.IsHome) .Site.Params.canonical .Params.canonical }}
{{- range $canonical }}
<link rel="canonical" href="{{ trim . " " }}" />
{{- end }}
{{- if .Site.Params.analytics.google.SiteVerificationTag }} {{- if .Site.Params.analytics.google.SiteVerificationTag }}
<meta name="google-site-verification" content="{{ .Site.Params.analytics.google.SiteVerificationTag }}" /> <meta name="google-site-verification" content="{{ .Site.Params.analytics.google.SiteVerificationTag }}" />
{{- end}} {{- end}}