From 149067a8a23e5e574e0d4d1560b553404d4ef9ba Mon Sep 17 00:00:00 2001 From: Aniket Teredesai Date: Mon, 20 Feb 2023 22:42:27 +0530 Subject: [PATCH] add robots.txt disallow directive for hiddenPage --- layouts/robots.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/layouts/robots.txt b/layouts/robots.txt index f26f508..314a7d5 100644 --- a/layouts/robots.txt +++ b/layouts/robots.txt @@ -1,7 +1,9 @@ User-agent: * -{{- if hugo.IsProduction | or (eq site.Params.env "production") }} -Disallow: -{{- else }} +{{- if not (hugo.IsProduction | or (eq site.Params.env "production")) }} Disallow: / +{{- else }} +{{- range where site.RegularPages "Params.hiddenPage" true }} +Disallow: {{ .RelPermalink }} +{{- end }} {{- end }} Sitemap: {{ "sitemap.xml" | absURL }}