/yoast-sitemap-cli

Yoast Sitemap WP CLI plugin

Primary LanguagePHP

Yoast Sitemap CLI

Yoast Sitemap CLI is a WordPress plugin which provides a WP CLI command to build and cache the root sitemap generated by Yoast. This helps avoid the performance impacts caused to large sites when Yoast attempts to build the sitemap dynamically when it is requested.

This plugin adds the following WP CLI command to generate and cache the root sitemap:

wp yoast-sitemap-build-root

This will generate the root sitemap and store it as a vanilla XML file in the uploads directory. This will be automatically served when you hit the root sitemap index defined by Yoast. I.e. https://yoursite.com/sitemap_index.xml.

Set Up

This command should be configured to run via a cron every 10 mins or so, like so:

*/10 * * * * cd /srv/www/mysite/current && wp yoast-sitemap-build-root --url="https://yoursite.com" 2>&1 2>/dev/null