From 1ff47e11f0d79b537cf58e0ee6ed3bf04a96b12f Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 9 Sep 2024 12:29:13 +0000 Subject: [PATCH] [Feature Request #81]: Added support for customizable noindex in Hugo Pages Signed-off-by: GitHub Action --- hugo.toml.example | 3 ++- layouts/_default/baseof.html | 3 ++- layouts/partials/site-meta.html | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hugo.toml.example b/hugo.toml.example index 2201df9..08a8336 100644 --- a/hugo.toml.example +++ b/hugo.toml.example @@ -116,7 +116,8 @@ expiryDate = ["expiryDate"] # noIndex = false # denyRobots = "noindex, nofollow, noarchive" # allowRobots = "index, follow" - # noIndex = false + # siteNoIndex = false + # noIndexPages = ["404 Page not found"] [[params.socialLinks]] diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 12cd30c..1c3add0 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -20,7 +20,8 @@ {{- end -}} {{- block "head" . -}}{{- end -}} -{{- if templates.Exists "partials/extra-head.html" -}}{{- partial "extra-head.html" . -}}{{- end -}} +{{- if templates.Exists "partials/extra-head.html" -}}{{- partial "extra-head.html" . -}}{{- end -}} + {{- if .Site.Params.googleTagManager -}}{{- partial "googleTagManager_body.html" . -}}{{- end -}} {{- block "header" . -}}{{ end -}} diff --git a/layouts/partials/site-meta.html b/layouts/partials/site-meta.html index b3561cd..4fce7cd 100644 --- a/layouts/partials/site-meta.html +++ b/layouts/partials/site-meta.html @@ -2,7 +2,7 @@ -{{- if (or (in .Page.RelPermalink "404") (or .Site.Params.noIndex .Params.noIndex)) -}} +{{- if (or (in .Page.RelPermalink "404") (or .Site.Params.siteNoIndex .Params.noIndex) (in .Site.Params.noIndexPages .Title)) -}} {{- else -}}