Quantcast
Channel: Topic Tag: xml | WordPress.org
Viewing all articles
Browse latest Browse all 3201

XML sitemap header wrong after caching

$
0
0

We’ve written our own XML sitemap generator, which returns a Content-Type header like so:

header( ‘Content-Type: text/xml’ );

When viewing the sitemap page for the first time, the browser renders it as XML. However, once it is cached, subsequent calls return a Content-Type of text/html and the browser doesn’t render the XML (or the linked XSL stylesheet file).

I notice the same behaviour too with the Yoast SEO plugin and their sitemap.

What is the correct way of ensuring the text/xml header is honoured after the page is cached?


Viewing all articles
Browse latest Browse all 3201

Trending Articles