Sitemap.xml when using a base path

This article is for people using a base path for hosting your Notaku website following 🖇️Hosting under a /docs or /blog path or 📘Hosting under a /blog path

How to expose a combined sitemap.xml file

You will need a root sitemap.xml file that combine your main sitemap and your Notaku website sitemap (hosted on /docs or /blog)

Example sitemap.xml file

Here is an example sitemap.xml file that merges a sitemap hosted on the /docs path with the original sitemap (hosted on /original-sitemap.xml)
xml
<?xml version="1.0" encoding="UTF-8"?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap> <loc> http://www.example.com/original-sitemap.xml </loc> </sitemap> <sitemap> <loc> http://www.example.com/docs/sitemap.xml?host=www.example.com </loc> </sitemap> </sitemapindex>
Notice the ?host=example.com query parameter, you need to pass a host parameter with your domain name to use the correct urls in the child sitemap. Otherwise Notaku does not know what domain it should use for your pages urls.
If you already had a sitemap.xml file you will need to rename it and add an entry in <sitemapindex> (in the example above it has been renamed to original-sitemap.xml)

Submitting the sitemap to google

You will then need to submit your sitemap url to Google in your Search Console dashboard so that it can fetch your new urls.