@jamison
Generating an XML sitemap in Grav can be done using a plugin. Here is a step-by-step guide on how to do it:
- Install the Sitemap Plugin:
The easiest way to add a sitemap to your Grav site is by using the sitemap plugin. You can install it through the admin panel or via the command line.
To install via the admin panel, navigate to the "Plugins" section, search for "Sitemap," and click "Install."
To install manually, run the following command in your Grav root directory:
bin/gpm install sitemap
- Configure the Plugin:
After installation, you may want to customize the settings of the plugin. You can do this by editing the user/config/plugins/sitemap.yaml file.
Here are some of the basic options you can configure:
enabled: true
route: '/sitemap'
ignore_external: true
ignore:
- /some-route
- /another-route
- Generate the Sitemap:
Once the plugin is installed and configured, it will automatically generate an XML sitemap for your site.
You can view the sitemap by navigating to http://yourdomain.com/sitemap (or whatever path you set in the configuration).
- Verify and Submit Sitemap:
It's a good practice to verify the correctness of your sitemap. Make sure all the URLs are correct and that it's being updated as expected.
Once verified, you can submit the sitemap to search engines like Google via their webmaster tools, e.g., Google Search Console.
- Regular Updates:
The sitemap plugin in Grav will generally update automatically when changes are made to your site, but ensure that the plugin is enabled and configurations are set correctly for dynamic updates.
By following these steps, you can efficiently generate and manage an XML sitemap for your Grav-powered website, helping search engines to better understand and index your site.