Markus Michalski FAQ

XML Sitemap Generator: Technical Details

Technical structure of the XML Sitemap Generator: generation flow, services and URL providers, scheduled task, config subscriber, admin component, default interval and file system behaviour.

Deutsche Version

Back to overview

XML Sitemap Generator: Technical Details

Live Demo: Try this and other plugins live — no installation, no risk: demo.markus-michalski.net

Generation flow

graph TD
    A["Admin button / scheduled task / console command"] --> B["SitemapGeneratorService.generate()"]
    B --> C{"clearExisting?"}
    C -->|"yes"| D["FileWriterService: delete sitemap*.xml"]
    C -->|"no"| E["determine active URL providers"]
    D --> E
    E --> F["ProductUrlProvider"]
    E --> G["CategoryUrlProvider"]
    E --> H["CmsPageUrlProvider"]
    E --> I["ManufacturerUrlProvider"]
    F --> J["XmlWriterService: urlset per file"]
    G --> J
    H --> J
    I --> J
    J --> K["FileWriterService: write sitemap-type.xml"]
    K --> L["XmlWriterService: sitemapindex"]
    L --> M["FileWriterService: write sitemap.xml"]

There is no cache: every call of generate() reads the data anew and writes the files anew.

Building blocks

Class Responsibility
SitemapGeneratorService Orchestrates generation, splits at the file limit, writes the index
AbstractUrlProvider and four providers Deliver the URLs per type as a generator, default values for priority and change frequency
HreflangService Reads alternate SEO URLs of all languages via SQL in one block
XmlWriterService Creates urlset and sitemapindex as XML (DOM)
FileWriterService Writes, deletes and lists files in the target directory
ConfigService Reads the plugin settings (MmdSitemap.config.*) per Sales Channel, cleans directory and slug
GenerateSitemapCommand Console command mmd:sitemap:generate
SitemapGenerationTask and SitemapGenerationTaskHandler Scheduled task mmd.sitemap.generation
ConfigChangeSubscriber Transfers a changed interval to the scheduled task
SitemapController Admin API routes for generation and statistics
MmdSitemap Plugin class, cleans up task and settings on uninstall

The providers are tagged mmd.sitemap.url_provider in the service container and are processed in the order products (100), categories (90), CMS pages (80), manufacturers (70). A custom provider can therefore only be attached through the container, there is no documented extension point.

Processing

Scheduled task and interval

Admin interface

The Vue component mmd-sitemap-generator is embedded in the plugin configuration as the Manual Generation card. It reads the Sales Channel from the parent configuration page, calls the Admin API and shows statistics and result. Texts come from the snippets in German and English.