This repository was archived by the owner on Sep 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
This repository was archived by the owner on Sep 14, 2021. It is now read-only.
extension elements in sitemaps #151
Copy link
Copy link
Open
Labels
Type: BugSomething isn't workingSomething isn't working
Description
extension elements in sitemaps
Describe the bug
#88 added filters that allow extension elements to be added to sitemaps (e.g., core_sitemaps_posts_url_list).
However, there are a couple of problems with the solution:
Core_Sitemaps_Renderer::get_sitemap_xml()outputs all elements in the sitemaps namespace (i.e.,http://www.sitemaps.org/schemas/sitemap/0.9) and the sitemaps XML Schema specifies that any element children ofsitemap:urlother thansitemap:loc,sitemap:lastmod,sitemap:changefreqandsitemap:prioritymust be in another namespace (wheresitemap:xyzis a QName for an element whoselocal-name()isxyzand whosenamespace-uri()is the sitemaps namespace URI). Therefore, if a plugin hooks intocore_sitemaps_posts_url_listand adds afooproperty to each URL in the list, the generated sitemap XML will be invalid against the XML Schema. There is currently no way for a plugin to tell the renderer what namespace to use for these extension elements.- The sitemaps XML Schema also specifies that the child elements of
sitemap:urlmust be in the order above, with all elements in a foreign namespace coming at the end. So, if a plugin hooks intocore_sitemaps_posts_url_listand does something likeforeach ( $url_list as $url ) { $url = array_merge( array( 'priority' => 0.9 ), $url ); }thenCore_Sitemaps_Renderer::get_sitemap_xml()will output a sitemap that is invalid against the XML Schema.
I do not know whether sitemap consumers (e.g., Google, Bing, Yandex, etc) would fail to process a sitemap that was invalid against the XML Schema, but do we want to try our best to ensure that generated sitemaps are valid?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type: BugSomething isn't workingSomething isn't working