Before and After xmlsitemap alternate URLs enhancement

This patch is intended to help those that want to enchance xmlsitemap in similar ways as the above image. This solution is closely tied to a large custom project, and not meant to be direclty applied to the module.

While working on a drupal project that had a rather nifty multi-region implementation (todo: future blog), it was required to have a single sitemap for all regions with default and alternate urls in it, as suggested by google - https://support.google.com/webmasters/answer/189077

None of the modules that extend xmlsitemap fit the bill -

After exploring all options, the custom changes submitted in this issue were made. Hope this helps others. (NOTE: code has been simplified to work for anybody, and show what's going on)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Sumeet.Pareek’s picture

After exploring all options, the custom changes submitted in this issue were made. Hope this helps others. (NOTE: code has been simplified to work for anybody, and show what's going on)

When there's time, I would try to work on getting this to work with entity_translation and other popular use cases.

Sumeet.Pareek’s picture

Status: Active » Needs review

Moving to NR, since this issue was a "feature request" for custom enhancements, and feedback on the approach is welcome.

Sumeet.Pareek’s picture

Issue summary: View changes
Dave Reid’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#2387557: Support more advanced XML element output

This is totally already possible with the existing APIs - use hook_xmlsitemap_element_alter() and provide your data in $element in a way that format_xml_elements() understands. Marking as a duplicate of #2387557: Support more advanced XML element output