Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image caption is always wrapped in CDATA in the output xml #97

Open
jd1378 opened this issue Jan 8, 2020 · 5 comments
Open

image caption is always wrapped in CDATA in the output xml #97

jd1378 opened this issue Jan 8, 2020 · 5 comments

Comments

@jd1378
Copy link

jd1378 commented Jan 8, 2020

Version

2.0.1

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

This bug report is available on Nuxt community (#c75)
@ghost ghost added the cmty:bug-report label Jan 8, 2020
@NicoPennec
Copy link
Member

It's not an issue, but a feature from the sitemap.js lib to secure by default your XML content of element, because all HTML entities should be escaped or wrapped in a CDATA block.

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 ekalinin/sitemap.js#245). But currently the sitemap-module cannot bump to v5 due to a breaking change :-/

@jd1378
Copy link
Author

jd1378 commented Jan 21, 2020

@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 ?

@jd1378
Copy link
Author

jd1378 commented Jan 21, 2020

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 ?

@jd1378
Copy link
Author

jd1378 commented Jan 21, 2020

I created #100 pull request on this matter.

@mimbo119
Copy link

mimbo119 commented May 24, 2021

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants