mirror of
https://github.com/gohugoio/hugo.git
synced 2026-09-03 12:12:37 +00:00
1.3 KiB
1.3 KiB
title, linktitle, description, date, publishdate, lastmod, categories, tags, weight, draft, aliases, toc, needsreview
| title | linktitle | description | date | publishdate | lastmod | categories | tags | weight | draft | aliases | toc | needsreview | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Robots.txt File | Robots.txt | 2017-02-01 | 2017-02-01 | 2017-02-01 |
|
|
165 | false |
|
false | true |
Hugo can generate a customized robots.txt in the same way as any other template.
To enable creating your robots.txt as a template, set the enableRobotsTXT value to true in your project's configuration file. By default, this option generates a robots.txt with the following content, which tells search engines that they are allowed to crawl everything:
User-agent: *
Robots.txt Template Lookup Order
The lookup order for the robots.txt template is as follows:
/layouts/robots.txt/themes/<THEME>/layout/robots.txt
Robots. txt Template Example
The following is an examplerobots.txt layout:
{{% code file="layouts/robots.txt" download="robots.txt" %}}
User-agent: *
{{range .Data.Pages}}
Disallow: {{.RelPermalink}}
{{end}}
{{% /code %}}
This template disallows all the pages of the site by creating one Disallow entry for each page.