- Issue created by @Gnanagowthaman sankar
- Status changed to Postponed: needs info
over 1 year ago 2:55pm 29 June 2023 - 🇩🇪Germany gbyte Berlin
3.x is unsupported. Please use 4.x and let me know if what you are after can be achieved. If not, please be very specific as I am not sure what you mean with 'mapping xml'. If you mean having a sitemap index for all the sitemaps, this is already possible with 4.x.
- 🇮🇳India Gnanagowthaman sankar Puducherry
Hi @gbyte,
First of all, I'm sorry for using the term mapping.xml.
By upgrading the module to the 4.x version, I can achieve the above structure. Thank you so much. I have one more question. Let's assume www.example.com contains a sitemap.xml (www.example.com/sitemap.xml). By clicking that, it should open the following structure, which should bring different sitemaps into this parent www.example.com/sitemap.xml. Is it possible to achieve this, or do I require any hooks or additional plugins or any contrib module to achieve the following output? Please guide me. Thank you.
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <sitemap> <loc>https://www.test.com/sitemap.xml</loc> </sitemap> <sitemap> <loc>https://www.sample.com/sitemap.xml</loc> </sitemap> <sitemap> <loc>https://www.dummy.com/sitemap.xml</loc> </sitemap> <sitemap> <loc>https://www.random.com/sitemap.xml</loc> </sitemap> </sitemapindex>
- Status changed to Needs review
over 1 year ago 3:17am 3 July 2023 - 🇮🇳India Gnanagowthaman sankar Puducherry
Hi gbyte, could you please review the above one.
- Status changed to Fixed
8 months ago 1:04pm 22 March 2024 - 🇩🇪Germany gbyte Berlin
Sorry for the late answer, I missed this support request twice apparently. :(
It's possible to have external links to sitemaps in a sitemap index type of sitemap. Here is how:
- The simplest approach would be creating a new sitemap type via UI with "Sitemap index generator" as sitemap generator and "Arbitrary URL generator" as URL generator.
- Then create a sitemap of this type.
- Now implement hook_simple_sitemap_arbitrary_links_alter() and add the URLs programmatically. Example:
function hook_simple_sitemap_arbitrary_links_alter(array &$arbitrary_links, SimpleSitemapInterface $sitemap) { // Add an arbitrary link to all sitemaps. $arbitrary_links[] = [ 'url' => 'https://some-arbitrary-link/', // An ISO8601 formatted date. 'lastmod' => '2012-10-12T17:40:30+02:00', ]; }
There is of course also the cleaner way which is to implement a URL generator plugin yourself and using that instead of using the arbitrary link plugin. I hope this helps.
Automatically closed - issue fixed for 2 weeks with no activity.