Checking Links on Build
See your link checker results when you build.
Introduction
By default, links will be scanned when you run your build.
Throwing Build Errors
When building and deploying your app in a CI, you may like to disable the deployment if there are any broken links.
To do so you can enable the failOnError
option. This will exit the process with a non-zero exit code.
export default defineNuxtConfig({
linkChecker: {
failOnError: true,
},
})
Generating Reports
To make working in a CI environment easier, you are able to generate a static report of the broken links.
There are two reports available: html
and markdown
.
To generate them, you can provide the report
option:
export default defineNuxtConfig({
linkChecker: {
report: {
// generate both a html and markdown report
html: true,
markdown: true,
}
},
})
The reports will be output in the following paths:
html
:./output/link-checker-report.html
markdown
:./output/link-checker-report.md
Disabling Build Scans
If you want to disable build link scanning, you can set runOnBuild
to false
in your nuxt.config
:
export default defineNuxtConfig({
linkChecker: {
runOnBuild: false,
},
})
Did this page help you?