I've created a module that extends XML Sitemap by adding a custom context. The additional context allows the creation of different sitemaps which include nodes updated during a certain time period.
To view the sitemap with the chosen time-context, you need to load sitemap.xml?time=30-days
or sitemap.xml?time=7-days
, etc. However, when you view the list of sitemaps in the XML sitemap module (/admin/config/search/xmlsitemap), each sitemap in the list (each with a different context) links to the plain sitemap.xml
, without the 'time' parameter.
I've discovered that I can add the ?time=x parameter to the links in that list by adding the line
<?php
$options['query']['time'] = $context['time']
?>
However, the problem with this is that it applies the same query suffix to every single one of the page links that XML sitemap generates. In other words, the URLs in the time-context sitemap will then look like http://example.com/node/1234?time=30-days
, which isn't what I want. After all, the Drupal content itself doesn't need a context in this case.
TL;DR: I want my list of sitemaps to appear as:
sitemap.xml
sitemap.xml?time=7-days
sitemap.xml?time=30-days
...
My sitemap page indexes to include the context:
sitemap.xml?time=7-days&page=1
sitemap.xml?time=7-days&page=2
...
And my sitemap entries to *not* include the context:
node/1234
node/1235
...
Is there a way to do this that I'm missing, or would it require alteration to the XML Sitemap module itself?