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

fix(html-validator): ensure compatibility #3291

Closed
dargmuesli opened this issue Mar 31, 2025 · 5 comments · Fixed by #3302
Closed

fix(html-validator): ensure compatibility #3291

dargmuesli opened this issue Mar 31, 2025 · 5 comments · Fixed by #3302

Comments

@dargmuesli
Copy link
Member

Environment

  • Operating System: Linux
  • Node Version: v22.14.0
  • Nuxt Version: 3.16.1
  • CLI Version: 3.24.0
  • Nitro Version: 2.11.8
  • Package Manager: [email protected]
  • Builder: -
  • User Config: modules, devtools, future, compatibilityDate, content
  • Runtime Modules: @nuxt/[email protected], @nuxtjs/[email protected]
  • Build Modules: -

Version

v3.4.0

Reproduction

https://stackblitz.com/edit/github-l2iaunq8?file=nuxt.config.ts

Make sure to download the project and run it with a modern Node version for SQLite support!

Then use pnpm build to get the logs as shown below.

Description

When having @nuxtjs/html-validator, the validator tries to parse the SQLite file's doctype (/__nuxt_content/content/sql_dump) as that route is part of prerendering. Should the database file be part of prerendering? It seems to be the only prerendered page, even in a large project of mine with many "actual" pages, which makes me think it shouldn't.

Additional context

 ERROR  HTML validation errors found for /__nuxt_content/content/sql_dump                                                                                                       12:09:38 AM

inline
  1:1  error  Document is missing doctype  missing-doctype

✖ 1 problem (1 error, 0 warnings)

More information:
  https://html-validate.org/rules/missing-doctype.html

Logs

@dargmuesli
Copy link
Member Author

Maybe we could rename this ticket to "fix(nitro): sql file should not be prerendered" if this is indeed the case.

@atinux
Copy link
Member

atinux commented Apr 3, 2025

I think we should specify to the html-validator to ignore this route @dargmuesli

Could you try with:

htmlValidator: {
  ignore: [/\.(xml|rss|json)$/, /^\/__nuxt_content/]
}

And see if this fixes the issue?

@dargmuesli
Copy link
Member Author

dargmuesli commented Apr 3, 2025

I tried that, somehow it doesn't ignore as expected (updated the reproduction, error still shows). The following does not show the error though:

nitro: {
  prerender: {
    ignore: ['/__nuxt_content/content/sql_dump'],
  }
}

But I guess the prerender is intended?

@farnabaz
Copy link
Member

farnabaz commented Apr 4, 2025

Hey @dargmuesli
This should be fixed in #3302. You can try using PR release

npm i https://pkg.pr.new/@nuxt/content@3302

@dargmuesli
Copy link
Member Author

That's a nice fix, works! 🎉

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

Successfully merging a pull request may close this issue.

3 participants