Skip to content

Commit

Permalink
[Feature Request #81]: Added support for customizable noindex in Hugo…
Browse files Browse the repository at this point in the history
… Pages

Signed-off-by: GitHub Action <[email protected]>
  • Loading branch information
actions-user committed Sep 9, 2024
1 parent 7615345 commit 1ff47e1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion hugo.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down
3 changes: 2 additions & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
<link rel="stylesheet preload prefetch" as="style" href="{{ $c_css.Permalink }}" {{ printf "integrity=%q" $c_css.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous">
{{- end -}}
{{- block "head" . -}}{{- end -}}
{{- if templates.Exists "partials/extra-head.html" -}}{{- partial "extra-head.html" . -}}{{- end -}}</head>
{{- if templates.Exists "partials/extra-head.html" -}}{{- partial "extra-head.html" . -}}{{- end -}}
</head>
<body id="page">
{{- if .Site.Params.googleTagManager -}}{{- partial "googleTagManager_body.html" . -}}{{- end -}}
{{- block "header" . -}}{{ end -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/site-meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
{{- 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)) -}}
<meta name="robots" content="{{ .Site.Params.denyRobots | default "noindex, nofollow, noarchive" }}">
{{- else -}}
<meta name="robots" content="{{ .Site.Params.allowRobots | default "index, follow" }}">
Expand Down

0 comments on commit 1ff47e1

Please sign in to comment.