# `MishkaCmsCore.Runtime.Resources.Notifiers.SitemapRefresh`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mishka_cms_core/runtime/resources/__notifiers/sitemap_refresh.ex#L5)

A reusable Ash notifier that rebuilds a site's sitemap after a write to a row it is built from.

Notifiers run **after the transaction commits**, for every action of a resource that lists this —
master twins, bulk actions and actions added later included. Each hands the record's site to
`MishkaCmsCore.Runtime.Compilers.SitemapCompiler.schedule/1`, which enqueues that site's
`"sitemap"` job; a burst of writes is one build.

The site is the RECORD's `site_id`, not the changeset's tenant: a master twin runs with none. A
`nil` one is a global row, so every open site is rebuilt. On `MishkaCmsCore.Runtime.Setting` only
the keys a sitemap reads count.

An extension whose `seo:sitemap:urls` plugin lists rows of a resource adds it beside that
resource's other notifiers:

    use Ash.Resource,
      ...,
      notifiers: [
        Ash.Notifier.PubSub,
        MishkaCmsCore.Runtime.Resources.Notifiers.PluginHook,
        MishkaCmsCore.Runtime.Resources.Notifiers.SitemapRefresh
      ]

Pages and layouts do not list it: `MishkaCmsCore.Runtime.Workers.RuntimeCompilerWorker` enqueues
the job after their own. Nor does a site: `ScheduleSiteRuntime` and `BootHandler.compile_site/2`
do.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
