Nuxt.js: Vue-Meta Doesn't Encode HTML Characters In 'generate'

Created on 28 Feb 2020  路  3Comments  路  Source: nuxt/nuxt.js

Version

v2.11.0

Reproduction link

https://github.com/hecktarzuli/vue-meta-generate-bug

Steps to reproduce

Clone repo
do a 'yarn generate'
View the home page source, notice the meta description still has the < > in the field.

Do a yarn build
yarn start
View the home page source, notice the meta description is properly encoded.

What is expected ?

That fields are encoded the same using generate or build.

What is actually happening?

Only 'build' encodes them.

bug-report

Most helpful comment

It's because of the HTML minifier options. You can fix it with

html: {
    minify: {
      collapseBooleanAttributes: true,
      decodeEntities: false, // <----------- Disable this option, Nuxt enables it by default
      minifyCSS: true,
      minifyJS: true,
      processConditionalComments: true,
      removeEmptyAttributes: true,
      removeRedundantAttributes: true,
      trimCustomFragments: true,
      useShortDoctype: true
    }
  },

All 3 comments

It's because of the HTML minifier options. You can fix it with

html: {
    minify: {
      collapseBooleanAttributes: true,
      decodeEntities: false, // <----------- Disable this option, Nuxt enables it by default
      minifyCSS: true,
      minifyJS: true,
      processConditionalComments: true,
      removeEmptyAttributes: true,
      removeRedundantAttributes: true,
      trimCustomFragments: true,
      useShortDoctype: true
    }
  },

@matteo-rigon I will give that a try, thank you!

That works as advertised, thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pehbehbeh picture pehbehbeh  路  3Comments

vadimsg picture vadimsg  路  3Comments

o-alexandrov picture o-alexandrov  路  3Comments

jaredreich picture jaredreich  路  3Comments

bimohxh picture bimohxh  路  3Comments