How data flows during sitemap generation
masterThe generation process follows these steps:
- Trigger: You call
SitemapGenerator::Sitemap.create { ... }or run thesitemap:refreshRake task. - Delegation:
Sitemapdelegates the call toLinkSet#create. - Evaluation:
LinkSetresets its state, applies your options, and passes your block to theInterpreter. - Link Collection: The
Interpreter(using Rails helpers if available) callsLinkSet#addfor every link you define. - Buffering:
LinkSet#addappends links to the currentSitemapFile. When a file hits its limit (50k links or 50MB), it is finalized and a new one begins. - Finalization: Once the block finishes,
LinkSet#finalize!closes the lastSitemapFileand writes theSitemapIndexFile. - Persistence: The raw XML for each file is passed to the configured adapter's
write(location, raw_data)method to be saved.