XML Sitemap Generator: Console Commands
Console command mmd:sitemap:generate of the XML Sitemap Generator for OXID eShop 7: options, flow, behaviour with several languages and types, plus examples.
XML Sitemap Generator: Console Commands
The module registers exactly one command for oe-console:
vendor/bin/oe-console mmd:sitemap:generate
Without options the command builds the sitemaps for products, categories, CMS pages and manufacturers (as far as enabled in the settings), then the static sitemap (if enabled) and finally the sitemap index sitemap.xml.
Options
| Option | Description |
|---|---|
-c, --clear |
Deletes all sitemap*.xml files in the output directory before generation |
-t, --type |
Generate only certain types: products, categories, cms, manufacturers. Can be given several times |
-l, --lang |
Generate only the given language ID. Without it, all languages configured in the shop run |
-s, --shop |
Shop ID for the database queries of the content, see the note below |
Flow and output
- The command prints shop ID, output directory, languages and types
- With
--clear, existing sitemap files are deleted and the count is reported - For each language and type one file is written and the number of URLs is shown. Disabled types are reported as skipped, types without URLs as "No URLs"
- The static sitemap is created when
blEnableStaticUrlsis on and active entries exist - Finally the command writes
sitemap.xmland reports the total of URLs and files. The index is written only if at least one file with at least one URL was created in this run, otherwise an existingsitemap.xmlstays untouched
If writing a file fails, the command aborts with exit code 1. On success the exit code is 0.
Behaviour you should know
With several languages, every pass writes to the same file, for example
sitemap-products.xml. The language processed last overwrites the previous ones. If you want a specific language in the sitemap, generate it explicitly with-l <language ID>.
The sitemap index
sitemap.xmllists only the files created in the current run. A run with-t productstherefore replaces the index with one that contains onlysitemap-products.xml.
- The static sitemap does not depend on
-t: ifblEnableStaticUrlsis on, it is created on every run - The value
staticfor-tis silently ignored, as are unknown type names. If no type remains, no type sitemaps are created and the command still exits with code 0 - With
-l, a language ID that is not in the shop's language list is accepted anyway. The queries then run with that ID, and the language code shown in the output isde --cleardeletes every file matchingsitemap*.xml, including files that do not come from this module- With
-s, the shop ID changes in the queries for products, categories, CMS pages and manufacturers as well as in the hreflang query, and the output shows it. The module always reads shop URL, language list and static URLs for shop ID 1
Examples
# Generate only the product sitemap
vendor/bin/oe-console mmd:sitemap:generate -t products
# Generate only language ID 0
vendor/bin/oe-console mmd:sitemap:generate -l 0
# Delete old files and regenerate
vendor/bin/oe-console mmd:sitemap:generate --clear
# Several types
vendor/bin/oe-console mmd:sitemap:generate -t products -t categories
The admin button runs the equivalent of mmd:sitemap:generate -c -s <shop ID>, see Configuration.