-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
sitemap.xml and robots.txt example #4163
Conversation
Thanks for the example, just a question, how is this different to https://github.com/zeit/next.js/tree/canary/examples/root-static-files? Could we improve the already existent example instead of creating a new one? |
Why not just do something like this within your package.json? postbuild: "cp robots.txt sitemap.xml .next", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine to me
Thanks @timneutkens ! |
@klyburke just curious: how do you make sure that when posts update, sitemap is updated too? Looks like at the momemt sitemap is generated on server launch only. |
@kachkaev good question. I've updated the example and added a description to the README to address it. The current example does not automatically update sitemap when the posts are changed (by changing This app, in which posts are fetched from a database, does update sitemap after the |
This example app shows you how to set up sitemap.xml and robots.txt files for proper indexing by search engine bots.
Just installed this and everything is working locally except for the robots.txt doesn't seem to be getting generated. I can console.log the path and it's displaying the correct path in the static folder, but the .get Route is not writing the file. Please advise if you can, thanks! |
This example app shows you how to set up sitemap.xml and robots.txt files for proper indexing by search engine bots.