#50465 closed enhancement (wontfix)
Provide filters to add extra sitemap entries
Reported by: | Chouby | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Sitemaps | Keywords: | |
Focuses: | Cc: |
Description
For the compatibility of Polylang with the new sitemap feature, I wrote a proof of concept against the feature plugin (version 0.2). In this proof of concept, I used the filters core_sitemaps_users_url_list
and core_sitemaps_posts_url_list
which have been removed by https://github.com/GoogleChromeLabs/wp-sitemaps/pull/195
Would it be possible to re-introduce the removed filters?
More on the context:
The page sitemap may include the home url. In a multilingual context, there is one home url per language, so I need to add the missing ones.
The users sitemap provides one archive url per author. In a multilingal context, there is one author archive url per language, so I need to add the missing author archives.
Change History (7)
#2
@
4 years ago
The new filter wp_sitemaps_posts_query_args
is interesting. for another topic, I had to use the parse_query
action. The new filter will help me to simplify the code and remove tests.
But homepages are not necessarily pages. For the same reason you need to add the home url separately from the query, I have to add the translated homepages separately too.
#3
@
4 years ago
While I'll be looking into this, have you considered just creating an additional sitemaps provider to add custom entries? This way you can better handle things like pagination, wheres with the old core_sitemaps_posts_url_list
you could easily mess up pagination.
#5
@
4 years ago
- Keywords reporter-feedback removed
- Resolution set to wontfix
- Status changed from new to closed
In fact I used these filters because they were available when I worked on the sitemaps compatibility, and to be honest, I did not investigate any other method at that time since I could do everything I needed.
Anyway, since you seem to fear to re-introduce these filters, I spent the last hours to develop a new method which doesn't need any extra filter than the already existing ones.
So I believe that we can close the ticket.
#6
@
4 years ago
- Milestone Awaiting Review deleted
@Chouby Thanks for your feedback! To clarify, I'm not against re-introducing these filters, but I want to understand better why/how/if they are needed.
Could you perhaps share how you have implemented this currently? Curious to hear what you came up with. Personally, I think a custom provider would be an elegant choice.
#7
@
4 years ago
I went to a totally different method.
My original idea was to mix all languages in one sitemap. This is the natural way for posts and terms. And that's why I needed to add extra entries for the translated homepages and the author archives.
I didn't want to create a custom provider as, in my opinion, this could potentially lack compatibility with 3rd party plugins which wouldn't be aware of this custom provider. But this gave me the idea to dynamically change the behaviour of the existing providers to create one sitemap per language.
You can see the current status here: https://github.com/polylang/polylang/pull/531
Thanks for sharing your feedback!
Have you tried the WP_Query / query args filters we‘ve added to achieve this?