You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I have a situation where I wish to "update" the sitemap index file, adding more links to it,over time. We have a lot of dynamic content generation on our site.
When I do the following:
SitemapGenerator::Sitemap.create do
add_to_index "/new_sitemap.xml.gz"
end
I find that it overwrites the old sitemap index file.
Any links that were present in the older sitemap index are gone,and now I only have one link with "new_sitemap.xml.gz" in the index.
How do I update the index file, so that it preserves older links?
Thanks.
The text was updated successfully, but these errors were encountered:
@wordjelly there is no mechanism for updating a sitemap. Because sitemaps are XML files, there is no easy way to do that. You could write something yourself, but the general approach is to just regenerate your entire sitemap periodically (as often as you need to). That is the simplest approach. Sometimes people will generate sitemap files for only the new content since the last run (and ensure that the new files don't replace existing ones), then regenerate only the index by adding links for each of the old sitemaps, and the new sitemap(s). Otherwise you will have to parse the XML index file, add the new links and rewrite the file.
Unless you have millions of links and/or are needing to add content multiple times a day, by far the simplest is to just regenerate each time.
Hi,
I have a situation where I wish to "update" the sitemap index file, adding more links to it,over time. We have a lot of dynamic content generation on our site.
When I do the following:
I find that it overwrites the old sitemap index file.
Any links that were present in the older sitemap index are gone,and now I only have one link with "new_sitemap.xml.gz" in the index.
How do I update the index file, so that it preserves older links?
Thanks.
The text was updated successfully, but these errors were encountered: