list pages with robotsNoIndex in robots.txt

This commit is contained in:
Martin Pittermann 2022-04-30 13:25:00 +02:00
parent 7e03764251
commit 724b999be4

View File

@ -1,6 +1,12 @@
User-agent: *
{{- if hugo.IsProduction | or (eq site.Params.env "production") }}
{{- $noIndexPages := where .Site.Pages "Params.robotsNoIndex" true }}
{{- range $noIndexPages }}
Disallow: {{ .RelPermalink }}
{{- end }}
{{- if not $noIndexPages }}
Disallow:
{{- end }}
{{- else }}
Disallow: /
{{- end }}