Custom Robots.txt and sitemap.xml Templates


Hi - that was confusing. I rewrote it. It can be any page you want to exclude. Once you add the param, it should show up in the robots.txt.

Regarding the other question, could you make a new post please. From what you pasted it is hard to tell, and I want to ask if you could please have a look at Requesting Help and provide some more details, in the new post? Thanks.


Loving your code, thanks.

I noticed an issue: Multilingual pages, like, do not get added to robots.txt.

I have enableRobotsTXT = "true" in front matter of both files and

I expect to get two entries in robots.txt:


But I only get one /example/

What do you think is the problem?


Hmm, I imagine it is something with the range statement. I don’t have time to set up a test but, can you try {{ .Permalink }} instead? Or, maybe it needs absLangURL.

1 Like

Thanks, will give it a try later.


Tried using {{ .Permalink }} instead of {{ .RelPermalink }}. Did not work. It just gave me an absolute url output.

Then I tried using{{ .RelPermalink | relLangURL }} and absLangURL. Did not work either.

Did some more research but can not figure it out yet. Any ideas?