Support » Networking WordPress » Nested sitemap.xml files for Multisite subfolder install

  • BuzzMaven

    (@sitecreations)


    How can we automate the coverage of our entire subfolder-based Multisite network’s sitemaps?

    With multisite set up on subfolders, we get the form

    mainsite.com/sitemap.xml
    mainsite.com/subsite/sitemap.xml

    But it is not readily apparent to me how we can generate a nested sitemap at the root level which will help Googlebot find the subsite sitemaps.

    Normally you’d do this with a nested sitemap list within the root, or add it to robots.txt. But doing this manually undermines the dynamic nature of a multisite network… you have to remember to keep it updated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • sjaure

    (@sjaure)

    Hi @sitecreations,

    I believe that the best approach would be to use the robots.txt and apply the changes to it automatically.

    Here is an example using Yoast plugin and a small script into an mu-plugin https://wphelper.site/robots-txt-yoast-sitemap-multisite/

    Maybe not exactly what you need, but can be an inspiration.

    If you are not using Yoast plugin, and since I understand that your concern is to manually add new subsite sitemaps to robots.txt, you can use a similar code snippet that will hook into wpmu_new_blog action.

    Hope this helps. Take care!

    Sorry slow to reply and thank you. I appreciate the links to the ideas. The link to the wphelper.site URL won’t load for me.

    • This reply was modified 11 months, 3 weeks ago by  BuzzMaven.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Nested sitemap.xml files for Multisite subfolder install’ is closed to new replies.