How can my module add xml sitemap entries?
-
16-10-2019 - |
Question
I have a module with a page callback handler for the path "products". So if the user navigates to products/apples then the module presents a page about our apples, and if they go to products/oranges then etc. These pages include detail about the various products.
I would like XML Sitemap to be populated from my module. After all, it's my module that knows what products exist, their descriptions etc.
Any hook or anything I can use for that?
Solution
The base function you call is xmlsitemap_link_save.
I am unaware of any docs on how to use this, but nodes get added to the sitemap via xmlsitemap_node_nodeapi which in turn calls xmlsitemap_node_create_link. The code for that should provide some guidance on how to build $link
.