antfu-collective / vite-ssg

Static site generation for Vue 3 on Vite
MIT License
1.27k stars 129 forks source link

The quotation marks will be incorrectly escaped as " in application/ld+json. #365

Open YunTaoLin opened 11 months ago

YunTaoLin commented 11 months ago

Describe the bug

I am going to perform SSG on the following code:

<component :is="'script'" type="application/ld+json">{{ jsonld }}</component>

But the following code was generated. This will affect the result of Google analyze structured data, causing the structured data to be unanalyzable.

<script type="application/ld+json">
{
    {&quot;@context{&quot;: {&quot;https://schema.org{&quot;,
    {&quot;@type{&quot;: {&quot;BreadcrumbList{&quot;,
    {&quot;itemListElement{&quot;: [
      {
        {&quot;@type{&quot;: {&quot;ListItem{&quot;,
        {&quot;position{&quot;: 1,
        {&quot;item{&quot;: {
          {&quot;@id{&quot;: {&quot;https://example.com/home/en{&quot;,
          {&quot;name{&quot;: {&quot;Online Tools List{&quot;,
          {&quot;description{&quot;: {&quot;Be Good Tool&#39;s online list collect many kinds of convenient and easy-to-use online tools, all of which can be used for free, including online lottery, online wheel game, generator, computer, and update various memes from time to time, join us now!{&quot;
        }
      },
      {
        {&quot;@type{&quot;: {&quot;ListItem{&quot;,
        {&quot;position{&quot;: 2,
        {&quot;item{&quot;: {
          {&quot;@id{&quot;: {&quot;https://example.com/youtube-picker/en{&quot;,
          {&quot;name{&quot;: {&quot;Youtube Comment Sweepstakes Tool{&quot;,
          {&quot;description{&quot;: {&quot;The Youtube comment sweepstakes tool only needs to simply enter the URL of the video to get all the comments of the video. The organizer can set various filtering conditions, such as date range, length of comments, and filtering of repeated comments. It is definitely a good helper for video creators to hold events{&quot;
        }
      }
    ]
  }
                </script>

Reproduction

vite-ssg build

System Info

System:
    OS: Windows 10 10.0.22000
    CPU: (16) x64 AMD Ryzen 7 5700U with Radeon Graphics
    Memory: 4.31 GB / 15.39 GB
  Binaries:
    Node: 16.15.1 - C:\Program Files\nodejs\node.EXE
    npm: 8.11.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (114.0.1823.82)
    Internet Explorer: 11.0.22000.120

Used Package Manager

npm

Validations