0

After enabling the Simple XML Sitemap module, I couldn't find an option to configure or add fields to the sitemap. I want to include the Page Title as a field. Is this feature available in the module, or is there a better alternative for creating a sitemap with more granular configuration options? I reviewed the documentation but didn't find any relevant details.

The sitemaps only include the following data: URL, Last Modification Date, Change frequency, and Priority.

2 Answers 2

1

is there a better alternative for creating a sitemap with more granular configuration options?

I can't say "better", as that depends on your use case, but there is also the XML Sitemap module, which has far more options. Also way more bugs as a result.

However, I don't think either of these modules support adding the "Page Title" because they both implement the sitemaps.org specification, and title is not a part of that.

0

The Simple XML Sitemap only adds the URLs by default. In order to add titles to the sitemap XML, you would have to extend its functionality easily using alter hook.

hook_simple_sitemap_entities_alter()

Using above hook you need to first load the node and than node title as attribute in sitemap.

Don't forget to regenerate sitemap after enabling.

2
  • Thank you for this information. However, I am not sure where to add the alter hook. Is this something I have to do on the backend using a CLI?
    – Josh H
    Commented Sep 20 at 16:40
  • As this require custom code need to written, it will not be managed from Admin area but you need to do same in your local environment with below options Commented Sep 22 at 7:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.