Jetpack: Sitemaps: image sitemaps do not display in browser

Created on 30 Mar 2017  路  9Comments  路  Source: Automattic/jetpack

Image sitemaps, although listing all images on a site, don't appear to load in the browser. Here is an example:
https://jeremy.hu/image-sitemap-1.xml

If you view source you'll see that the sitemap contents are indeed there.

Sitemaps [Pri] BLOCKER [Type] Bug

Most helpful comment

Need to apply the_title_rss filters which will apply the same filters as Core (e.g. https://developer.wordpress.org/reference/functions/get_the_title_rss/ )

All 9 comments

It looks like some strings need to be entity encoded with esc_html.

For example, see this line. (Wait... $title is escaped. Huh...)

There are similar places in all the _to_sitemap_item functions.

The images seem to load for my image sitemap

https://dereksmart.wpsandbox.me/image-sitemap-1.xml

I don't know if it's related, but I am seeing this on one of my test sites where WP Super Cache is installed. WPSC is including its output at the bottom of the sitemap output:

<!-- Dynamic page generated in 0.664 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2017-04-04 15:44:48 -->

<!-- Compression = gzip -->

I ran the entire output through an XML validator, and it looks like at least part of the problem is escaping. We are allowing through & characters in image titles, which are not allowed in XML. We need to either encode them directly, or just wrap all title elements in cdata.

Just adding a note here that Google is rejecting the image sitemaps as invalid, I assume due to the character encoding issue (as that's all the third-party validators seem to be highlighting, I really with Google provided their own validator).

Edit: forgot to add https://sarahwallinhuff.com/image-sitemap-1.xml which also appears to be failing over the encoding issue.

user reported similar issue in 3162307-t

Need to apply the_title_rss filters which will apply the same filters as Core (e.g. https://developer.wordpress.org/reference/functions/get_the_title_rss/ )

user reported same issue in 3211788-t

user reported same issue in 3232464-t

Was this page helpful?
0 / 5 - 0 ratings