Jump to content

Sitemap — a new XML sitemap module with sitemap index, IndexNow, and an admin dashboard


Recommended Posts

Posted

I've been working on sites where the standard sitemap setup started showing cracks: XML generated on every request eating memory, no way to regenerate automatically without writing custom hooks, and no visibility into what actually ended up in the file.

So I built Sitemap — a module that generates static XML files to disk, splits output by template name, and handles the full lifecycle from generation to search engine notification.

What it does differently:

  • Writes files to disk instead of rendering in memory — no RAM spike on large sites
  • Pages are fetched in chunks of 500 with uncacheAll(), so memory stays flat regardless of page count
  • Each template gets its own named file: sitemap-product.xml, sitemap-blog.xml, etc. — the index at sitemap.xml references them all
  • Auto-regeneration via LazyCron with a configurable interval; the LazyCron hook slot is chosen dynamically to match what you configured (every hour, every 6 hours, daily, etc.) rather than always using everyHour
  • A needs_regen flag is set whenever a page is saved, trashed, or deleted — visible in the admin dashboard
  • IndexNow support: after generation, all URLs are submitted to api.indexnow.org in batches of 10,000
  • Sitemap: directive written directly to the physical robots.txt on save and on generate
  • Lock file prevents concurrent generation
  • Admin dashboard at Setup > Sitemap showing file count, URL count, total size, and last generated time

Settings stored in a dedicated DB table (sitemap_settings, name/value, MEDIUMTEXT) rather than the module's data field — avoids the serialized config size limit when template settings grow large.

Image sitemap extension and hreflang alternate links for multilanguage sites are both supported.

GitHub:

Screenshots:

sitemap1.thumb.png.3e0299bd10ade2595a9fa7958f3ba602.png

sitemap2.thumb.png.a8e9ade7e2eff6f5d608998de7e334e9.png

Still v1.0.0, so feedback is very welcome — especially from anyone running it on a site with 10k+ pages.

  • Like 11
  • Thanks 3
Posted

I tested on a site with ~12000 URLs, it seems to work fine 🙂

Right now, every user with page-edit permission can use the module, but there might be good reasons to restrict it to certain roles. Maybe you could add a "sitemap" permission to make this more granular?

  • Like 2
Posted

Amazing, this looks like the ultimate sitemap module (haven't tested yet) but as @dynweb said a role restriction should be definitely added. I guess replacing the 24th line of ProcessSitemap.module.php with the below will do the trick:

'permission' => 'sitemap-edit',
'permissions' => array(
 'sitemap-edit' => 'Edit Sitemap settings'
),

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...