Markus Michalski FAQ

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.

Deutsche Version

Back to overview

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

  1. The command prints shop ID, output directory, languages and types
  2. With --clear, existing sitemap files are deleted and the count is reported
  3. 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"
  4. The static sitemap is created when blEnableStaticUrls is on and active entries exist
  5. Finally the command writes sitemap.xml and 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 existing sitemap.xml stays 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.xml lists only the files created in the current run. A run with -t products therefore replaces the index with one that contains only sitemap-products.xml.

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.