hugo robots.txt code example
Example 1: Hugo Robots.txt template
User-agent: *
Disallow: /disclaimer/
Disallow: /partners/
Allow: /
Allow: /contact/
Allow: /blog/
{{ range where .Site.RegularPages "Type" "blog" }}
Allow: {{.RelPermalink}}
{{end}}
Sitemap: {{ .Sitemap.Filename | default "sitemap.xml" | absURL }}`
Example 2: Hugo Robots.txt template
In layouts/robots.txt
User-agent: *
{{range .Pages}}
Disallow: {{.RelPermalink}}
{{end}}