I am trying to generate a sitemap for my Rails app. I want to generate them on a periodic basis and not on every hit. I was previously using this to generate sitemaps https://github.com/kjvarga/sitemap_generator. This seems good for sitemaps under 50k urls. Now I want to create an index as well and divide my sitemaps based on page types that is all school pages will go into a school
sitemap similarly for other pages like student
, sports
etc.
Asked
Active
Viewed 1,456 times
1

Adam Young
- 1,321
- 4
- 20
- 36
2 Answers
0
You can do that with that same gem you mentioned. Please read Generating multiple sitemaps
And if you want to set them to check only periodically you change the <changefreq></changefreq>
to something like this: <changefreq> monthly </changefreq>

luissimo
- 916
- 2
- 10
- 31
-1
Using the sitemap_generator gem will be the easiest way to do it.
Simply write your generation login in sitemap.rb
file and run rake sitemap:refresh
to create your sitemap for the first time.
After doing that, run this command whenever you like by writing it in the crontab or using a gem like whenever which provides a dsl for writing periodic commands using cron.

Shobhit
- 647
- 1
- 7
- 19