diff options
author | tdro <tdro@noreply.example.com> | 2023-01-12 22:11:55 -0500 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2023-01-12 22:11:55 -0500 |
commit | 78fc8c3acfd493652e88d91fd9380d9d0e5fd80e (patch) | |
tree | 2d9e0d77e1e5ec077920922b12b55b6d77cdd87a | |
parent | 3adbe20402da7a59f13031c6094bb165d835a2b0 (diff) | |
download | canory-78fc8c3acfd493652e88d91fd9380d9d0e5fd80e.tar.gz canory-78fc8c3acfd493652e88d91fd9380d9d0e5fd80e.tar.bz2 canory-78fc8c3acfd493652e88d91fd9380d9d0e5fd80e.zip |
themes/default/layouts/partials/base-head: Add rel canonical
-rw-r--r-- | config.json | 3 | ||||
-rw-r--r-- | config.yaml | 1 | ||||
-rw-r--r-- | themes/default/layouts/partials/base-canonical.html | 15 | ||||
-rw-r--r-- | themes/default/layouts/partials/base-head.html | 3 |
4 files changed, 21 insertions, 1 deletions
diff --git a/config.json b/config.json index b62e983..edb3168 100644 --- a/config.json +++ b/config.json @@ -97,7 +97,8 @@ "production": false, "referrer": "no-referrer", "refresh": null, - "robots": "index,follow" + "robots": "index,follow", + "canonical": null }, "webmanifest": { "name": "Micro Blog", diff --git a/config.yaml b/config.yaml index 5f5c899..9d9a6b7 100644 --- a/config.yaml +++ b/config.yaml @@ -81,6 +81,7 @@ params: referrer: no-referrer refresh: robots: index,follow + canonical: webmanifest: name: Micro Blog shortName: Micro diff --git a/themes/default/layouts/partials/base-canonical.html b/themes/default/layouts/partials/base-canonical.html new file mode 100644 index 0000000..804c8ce --- /dev/null +++ b/themes/default/layouts/partials/base-canonical.html @@ -0,0 +1,15 @@ +{{- $canonical := .Permalink -}} + +{{- with .Site.Params.site.canonical -}} + {{- $canonical = print $.Site.Params.site.canonical $.RelPermalink -}} +{{- end -}} + +{{- with .Params.feed -}} + {{- $canonical = $.Params.feed.link -}} +{{- end -}} + +{{- with .Params.canonical -}} + {{- $canonical = $.Params.canonical -}} +{{- end -}} + + <link rel="canonical" href="{{ $canonical }}" /> diff --git a/themes/default/layouts/partials/base-head.html b/themes/default/layouts/partials/base-head.html index d9fb645..53d1fbc 100644 --- a/themes/default/layouts/partials/base-head.html +++ b/themes/default/layouts/partials/base-head.html @@ -53,6 +53,9 @@ <!-- Feed Discovery --> {{- partial "base-discovery.html" . -}} +<!-- Canonicalization --> +{{- partial "base-canonical.html" . -}} + <!-- Style Sheets & Scripts --> {{- $index := resources.Get "js/index.js" -}} {{- $default := resources.Get "css/default.css" -}} |