I’m running into an issue where it appears that within the robots.txt template [1] the sitemap variables [2] are not available. I can reproduce this issue with the following steps. First run hugo new example
to make a basic site. Then add the following to the config.toml file:
enableRobotsTXT = true
Then create the following file at layouts/robots.txt
:
User-agent: *
Sitemap: {{ .Sitemap.Filename }}
If you then run hugo
to generate the site, public/robots.txt
looks like this:
User-agent: *
Sitemap:
I could not find documentation or other posts/issues on this behavior. It can be worked around with something like {{ "sitemap.xml" | absURL }}
where you hard-code the sitemap name, but I’m wondering if this may be worth filing as a bug.