sitemap-module
sitemap-module copied to clipboard
image caption is always wrapped in CDATA in the output xml
Version
Reproduction link
https://codesandbox.io/s/epic-chatterjee-pnzlr
Steps to reproduce
use image with a caption in a route
What is expected ?
<url>
<loc>https://examplee.com/</loc>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
<image:image>
<image:loc>https://example.com/some-image.png</image:loc>
<image:caption>normal string</image:caption>
</image:image>
</url>
What is actually happening?
<url>
<loc>https://examplee.com/</loc>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
<image:image>
<image:loc>https://example.com/some-image.png</image:loc>
<image:caption><![CDATA[normal string]]></image:caption>
</image:image>
</url>
Additional comments?
And i don't know why my sandbox does not even generate the xml file properly anyway. I tried setting "cdata" to false in sitemap options defaults but it didn't help. I have tested the route example in the sandbox on my local environment and it got wrapped in cdata
It's not an issue, but a feature from the sitemap.js lib to secure by default your XML content of
So your XML still a valid sitemap: https://www.xml-sitemaps.com/validate-xml-sitemap.html?op=validate-xml-sitemap&go=1&sitemapurl=https%3A%2F%2Fpnzlr.sse.codesandbox.io%2Fsitemap.xml&submit=Validate+Sitemap
The cdata: false
option had an issue on sitemap.js v4 and should be fixed on v5 (see https://github.com/ekalinin/sitemap.js/issues/245). But currently the sitemap-module cannot bump to v5 due to a breaking change :-/
@NicoPennec
If the tests currently in project are written good, then bumping to v5 is easy, as it seems the tests only fail on xslUrl
option and mobile sitemap which both are dropped, then modifying the tests to exclude those would be easy
and they don't seem like a huge deal to me at least
the more important feature is the v5's streams to be implemented in a way to generate sitemaps without using much memory which is another discussion, so can you explain why we cannot bump to v5 ?
I think the only issue regarding xslUrl is #58 which only asks to add what's already in sitemap.js, which is not anymore, so I guess we are okay about that ?
I created #100 pull request on this matter.
any updates on cdata? i'm facing this cdata in news. my news data are :
news: {
publication: {
name: 'সময় নিউজ',
language: process.env.NEWS_LANG
},
publication_date: new Date(parseInt(news.updatedAt)).toISOString(),
title: news.title
}
but its showing like this in sitemap
<url>
<loc>http://somoy.test:5001/news/2-24-2021/what-is-lorem-ipsum-</loc>
<news:news>
<news:publication>
<news:name>
<![CDATA[ সময় নিউজ ]]>
</news:name>
<news:language>bn</news:language>
</news:publication>
<news:publication_date>2021-02-24T07:27:53.436Z</news:publication_date>
<news:title>
<![CDATA[ 2.What is Lorem Ipsum? ]]>
</news:title>
</news:news>
</url>