From f1fc8b6d84c3fe804eea5721aa4651e4bff3e7b4 Mon Sep 17 00:00:00 2001 From: Noam Lerner Date: Mon, 22 May 2023 17:03:52 +0300 Subject: [PATCH] Add support for canonical links --- README.md | 11 +++++++++++ layouts/_default/baseof.html | 1 + 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 1476767..a93af19 100644 --- a/README.md +++ b/README.md @@ -310,6 +310,17 @@ relative to the `static` folder of your Hugo site: All custom JS files will be added before closing body tag of a `baseof.html` file. +#### Enable User Canonical + +You can specify an explicit canonical link which helps to set a single source +of truth for your page. See [here](https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls#rel-canonical-link-method) +how this helps Google to crawl your page. + +```toml +[Params] + enableUserCanonical = true +``` + #### Entry Meta Entry metadata are relevant information about your entry such as published date, last modified date, category, etc. You diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index a1eec1a..a45d534 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -21,6 +21,7 @@ {{- $cssMain := resources.Get "css/main.css" }} {{- $cssPrint := resources.Get "css/print.css" }} {{- $style := slice $cssReboot $cssMain $cssPrint | resources.Concat "css/bundle.css" }} + {{if site.Params.enableUserCanonical}}{{end}} {{- range .Site.Params.customCSS }}