From efcca66ef32e6b5180a4d21abcf2e941c8a0aab3 Mon Sep 17 00:00:00 2001 From: Olivier Goulet Date: Mon, 3 Oct 2022 14:39:18 -0400 Subject: [PATCH 1/6] Create documentation pages for canonical url and metatag robot params and add meta tag robots --- exampleSite/content/params/canonical-url.md | 13 +++++++++++++ exampleSite/content/params/metatag-robots.md | 17 +++++++++++++++++ layouts/partials/head.html | 3 +++ 3 files changed, 33 insertions(+) create mode 100644 exampleSite/content/params/canonical-url.md create mode 100644 exampleSite/content/params/metatag-robots.md diff --git a/exampleSite/content/params/canonical-url.md b/exampleSite/content/params/canonical-url.md new file mode 100644 index 0000000..a9a547a --- /dev/null +++ b/exampleSite/content/params/canonical-url.md @@ -0,0 +1,13 @@ +--- +title: Canonical URL +hide_sidebar: true +canonical_url: https://google.com +--- + +The `canonical_url` config parameter sets the canonical url of the page. The value must be an *absolute url*. + +```md +title: Canonical URL +hide_sidebar: true +canonical_url: https://google.com +``` \ No newline at end of file diff --git a/exampleSite/content/params/metatag-robots.md b/exampleSite/content/params/metatag-robots.md new file mode 100644 index 0000000..a88ae13 --- /dev/null +++ b/exampleSite/content/params/metatag-robots.md @@ -0,0 +1,17 @@ +--- +title: Metatag Robots Config Parameter +hide_sidebar: true +metatag_robots: noindex, nofollow +--- + +The `metatag_robots` config parameter grants the ability to add a "robots" metatag with the set `content` attribute. + +The default value for `metatag_robots` is `noindex`. + +Usage: +```md +title: Metatag Robots Config Parameter +hide_sidebar: true +metatag_robots: noindex, nofollow +``` + diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 3c7d309..06493ca 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -35,6 +35,9 @@ {{- with .Params.page_favicon | default .Site.Params.favicon | default "https://www.eclipse.org/favicon.ico"}} {{- end -}} +{{- with .Page.Params.metatag_robots }} + +{{- end }} {{- with .Params.share_img | default .Params.image | default .Site.Params.share_img | default .Site.Params.logo }} -- GitLab From adf59f90e28568545425446c8a8ba3580cf9a943 Mon Sep 17 00:00:00 2001 From: Olivier Goulet Date: Mon, 3 Oct 2022 14:51:43 -0400 Subject: [PATCH 2/6] Add canonical_url functionality --- exampleSite/content/params/canonical-url.md | 6 ++++-- layouts/partials/head.html | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/exampleSite/content/params/canonical-url.md b/exampleSite/content/params/canonical-url.md index a9a547a..62f709a 100644 --- a/exampleSite/content/params/canonical-url.md +++ b/exampleSite/content/params/canonical-url.md @@ -1,10 +1,12 @@ --- title: Canonical URL hide_sidebar: true -canonical_url: https://google.com +scanonical_url: https://google.com --- -The `canonical_url` config parameter sets the canonical url of the page. The value must be an *absolute url*. +The `canonical_url` config parameter sets the canonical url of the page. The value must be an *absolute url*. + +If `canonical_url` is not speciifed, the canonical URL will be the pages' default url. ```md title: Canonical URL diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 06493ca..fa41b23 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -60,7 +60,8 @@ {{ hugo.Generator -}} - +{{ $canonical_url := .Page.Params.canonical_url | default (.Permalink | absLangURL) }} + {{ with .OutputFormats.Get "RSS" }} {{ end }} -- GitLab From 05c0c82feebcd3432fc675315dc0ae1c0afd21f7 Mon Sep 17 00:00:00 2001 From: Olivier Goulet Date: Mon, 3 Oct 2022 14:56:23 -0400 Subject: [PATCH 3/6] Fix typo --- exampleSite/content/params/canonical-url.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exampleSite/content/params/canonical-url.md b/exampleSite/content/params/canonical-url.md index 62f709a..26a6866 100644 --- a/exampleSite/content/params/canonical-url.md +++ b/exampleSite/content/params/canonical-url.md @@ -6,7 +6,7 @@ scanonical_url: https://google.com The `canonical_url` config parameter sets the canonical url of the page. The value must be an *absolute url*. -If `canonical_url` is not speciifed, the canonical URL will be the pages' default url. +If `canonical_url` is not specified, the canonical URL will be the pages' default url. ```md title: Canonical URL -- GitLab From 1c93cab9d73ba30cdbb83c74e739d575a62c0994 Mon Sep 17 00:00:00 2001 From: Olivier Goulet Date: Mon, 3 Oct 2022 14:58:24 -0400 Subject: [PATCH 4/6] Update doc --- exampleSite/content/params/metatag-robots.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exampleSite/content/params/metatag-robots.md b/exampleSite/content/params/metatag-robots.md index a88ae13..aa11597 100644 --- a/exampleSite/content/params/metatag-robots.md +++ b/exampleSite/content/params/metatag-robots.md @@ -6,7 +6,7 @@ metatag_robots: noindex, nofollow The `metatag_robots` config parameter grants the ability to add a "robots" metatag with the set `content` attribute. -The default value for `metatag_robots` is `noindex`. +If blank, no meta tag will be created for "robots". Usage: ```md -- GitLab From 7ebe24e173eab16cd974719b5885b1c69ab2e58f Mon Sep 17 00:00:00 2001 From: Olivier Goulet Date: Mon, 3 Oct 2022 15:05:21 -0400 Subject: [PATCH 5/6] Pass canonical url param into absLangURL --- exampleSite/content/params/canonical-url.md | 2 +- layouts/partials/head.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exampleSite/content/params/canonical-url.md b/exampleSite/content/params/canonical-url.md index 26a6866..f3cb8c2 100644 --- a/exampleSite/content/params/canonical-url.md +++ b/exampleSite/content/params/canonical-url.md @@ -1,7 +1,7 @@ --- title: Canonical URL hide_sidebar: true -scanonical_url: https://google.com +canonical_url: https://google.com --- The `canonical_url` config parameter sets the canonical url of the page. The value must be an *absolute url*. diff --git a/layouts/partials/head.html b/layouts/partials/head.html index fa41b23..90c177d 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -60,7 +60,7 @@ {{ hugo.Generator -}} -{{ $canonical_url := .Page.Params.canonical_url | default (.Permalink | absLangURL) }} +{{ $canonical_url := (.Page.Params.canonical_url | default .Permalink) | absLangURL }} {{ with .OutputFormats.Get "RSS" }} -- GitLab From 35d1ae6995e9f7e73c1966b1f3bce04c3c0dcf04 Mon Sep 17 00:00:00 2001 From: Olivier Goulet Date: Mon, 3 Oct 2022 15:12:04 -0400 Subject: [PATCH 6/6] Create doc page to show absLangURL usage on canonical_url --- exampleSite/content/params/canonical-url.fr.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 exampleSite/content/params/canonical-url.fr.md diff --git a/exampleSite/content/params/canonical-url.fr.md b/exampleSite/content/params/canonical-url.fr.md new file mode 100644 index 0000000..7cd5bdd --- /dev/null +++ b/exampleSite/content/params/canonical-url.fr.md @@ -0,0 +1,11 @@ +--- +title: Canonical URL - Testing LangAbsURL +hide_sidebar: true +canonical_url: ./params +--- + +This page tests whether or not `absLangURL` gets applied correctly to `canonical_url` param. + +The `canonical_url` is set to `./params`. + +The `href` value of the `` element should be `"///fr/params"`. \ No newline at end of file -- GitLab