blade
March 21, 2022, 12:16pm
1
I get a ‘404 error not found’ response when using a custom robots.txt template. I:-
Added enableRobotsTXT = true
to the configuration file.
Created a robots.txt file in the layouts folder with this content
User-agent: *
Sitemap: {{ site.Home.Sitemap.Filename }}
bep
March 21, 2022, 1:08pm
2
My best guess would be that you have not set enableRobotsTXT = true
… In TOML that may happen if you put it after you have started a map, e.g. [params]
, but that’s guesswork.
blade
March 21, 2022, 1:12pm
3
I have done that Sir.
The params are in ./config/default/params.toml
.
Perhaps I should ask, is the file visible in localhost with hugo serve
command by default?
blade
March 21, 2022, 1:32pm
5
I placed the code enableRobotsTXT = true
before any code with the brackets [...]
in the configuration file and I can see the result.
The layout files goes into “layouts/robots.txt” … NOT “layouts/_default/robots.txt”.
system
Closed
March 23, 2022, 2:06pm
7
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.