Add a URL alter hook when generating the sitemap

Created on 10 March 2021, about 4 years ago
Updated 14 November 2024, 5 months ago

Problem/Motivation

We ran into a situation in which we needed to generate a different URL than was created by the Url::fromUri call in XmlSitemapGenerator::generateChunk() on line 315. I noticed that immediately above it is a TODO concerning the creation of a hook, hook_xmlsitemap_base_url_alter, to alter the Url.

The attached patch includes the creation of a hook to modify the Url object before the string is generated.

Remaining tasks

No remaining tasks

API changes

hook_xmlsitemap_link_url_alter is added - checkout the xmlsitemap.api.php file for information.

Feature request
Status

Needs review

Version

1.0

Component

xmlsitemap.module

Created by

🇺🇸United States laboratory.mike

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024