XML Sitemap Generator: Installation
Installing the XML Sitemap Generator for OXID eShop 7 with Composer: package, activation, update, first generation and a cron job for regenerating the sitemaps on a schedule.
XML Sitemap Generator: Installation
Requirements
- OXID eShop ^7.0, PHP 8.2 or newer
- PHP extensions
ext-dom,ext-libxmlandext-pdo - Access to the Composer repository that hosts the package
mmd/oxid7-sitemap
Installation with Composer
The package lives in a private repository managed through Packeton. You receive the credentials after purchasing the license.
1. Add the private repository (to the shop's composer.json):
{
"repositories": [
{
"type": "composer",
"url": "https://packeton.markus-michalski.net"
}
]
}
2. Install the module:
composer require mmd/oxid7-sitemap
The OXID Composer plugin places the module in source/modules/mmd/sitemap. When Composer asks for credentials, enter the ones you received with your license.
3. Activate the module:
vendor/bin/oe-console oe:module:activate mmd_sitemap
vendor/bin/oe-console oe:cache:clear
The module ID is mmd_sitemap. Alternatively, you can activate it in the OXID admin under Extensions > Modules.
What happens on activation
- The module creates the table
mmd_sitemap_static_urlsif it does not exist yet (CREATE TABLE IF NOT EXISTS) - It creates the directory
source/export/sitemapif it is missing. With the default settings the module does not use this directory: the sitemap files end up insource/export/ - On deactivation, generated sitemap files and the table with the static URLs are kept
The module ships no database migrations. The table is created on activation only. If it is missing after an update, deactivate and reactivate the module once.
First generation
vendor/bin/oe-console mmd:sitemap:generate
Or click Generate Sitemap in the OXID admin under Sitemap > Overview. With the default settings, sitemap.xml is then located in source/export/ and served as <shop URL>/export/sitemap.xml. All options are listed on the Console Commands page.
Update
composer update mmd/oxid7-sitemap
vendor/bin/oe-console oe:module:apply-configuration
vendor/bin/oe-console oe:cache:clear
oe:module:apply-configuration applies new or changed module settings from the module configuration. Existing sitemaps do not change until you regenerate them.
Cron job for regeneration
The module has no scheduler of its own. To refresh the sitemaps regularly, call the console command from cron:
# Every day at 3 am
0 3 * * * cd /var/www/oxideshop && vendor/bin/oe-console mmd:sitemap:generate --clear
Adjust the path to the shop root for your environment. With --clear, all sitemap*.xml files in the output directory are deleted before generation, see Console Commands.