Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

robots.txt #2049

Closed
vat9 opened this issue Apr 5, 2016 · 7 comments
Closed

robots.txt #2049

vat9 opened this issue Apr 5, 2016 · 7 comments
Milestone

Comments

@vat9
Copy link

vat9 commented Apr 5, 2016

hugo v0.16-DEV-43B5DFA does not preserve static/robots.txt. Instead we get the default:

User-agent: *

in public/robots.txt

@bep bep added the Bug label Apr 5, 2016
@bep bep added this to the v0.16 milestone Apr 5, 2016
@bep
Copy link
Member

bep commented Apr 5, 2016

/cc @ifraixedes

@ifraixedes
Copy link
Contributor

I've checked it and behaves @vat9 mentioned.

Be aware that I'm not one of the maintainers of the project, so my comment may not be exactly right.

My thoughts is that robots.txt is treated as any other template, so if I do the same with any other template file it happens the same. For example I remove layouts/index.html and I place index.html in static (static/index.html) the public/index.html is the one generated by hugo, no the one placed in static.

Due that, I'm not sure if it could be considered a bug.

The solution, at least for now, it's to place robots.txt in layouts/robots.txt; if the file doesn't have any template lang, it will be copied as it is from there to public

@vat9
Copy link
Author

vat9 commented Apr 5, 2016

I've toggled the param disableRobotsTXT as well and still end up with the same public/robots.txt file. Placing it in layouts is a work around--or my concept of what is static and what is used for template generation may just be off.

bep added a commit that referenced this issue Apr 5, 2016
Meny people, including me, have a custom robots.txt in static.

Also remove that option from the command line; it doesn't feel
important enough.

Fixes ##2049
@bep
Copy link
Member

bep commented Apr 5, 2016

@vat9 I have reverted the flag logic so robots.txt isn't created as a default. But disableRobotsTXT should also work, I just tested it.

@bep
Copy link
Member

bep commented Apr 5, 2016

Fixed in 54750b0

@bep bep closed this as completed Apr 5, 2016
@ifraixedes
Copy link
Contributor

@vat9 I forgot the existence of that flag.
@bep great thanks, probably that logic make more sense, when I added it, I applied the same logic of the code around without thinking that much.

tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
Meny people, including me, have a custom robots.txt in static.

Also remove that option from the command line; it doesn't feel
important enough.

Fixes #gohugoio#2049
@github-actions
Copy link

github-actions bot commented Apr 8, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants