aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.json3
-rw-r--r--config.yaml1
-rw-r--r--themes/default/layouts/partials/base-canonical.html15
-rw-r--r--themes/default/layouts/partials/base-head.html3
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" -}}