Skip to content

site

Sites built to a folder: the build, valid HTML, broken links, unused CSS and assets, and the sitemap. It requires html. Guide: Static sites.

A scope has a filename sitemap.xml, or a dependency on @astrojs/sitemap, @astrojs/starlight, vitepress, @docusaurus/core, or @11ty/eleventy, unless the scope depends on next, nuxt, @sveltejs/kit, @remix-run/node, @react-router/node, expo, django, flask, @astrojs/node, @astrojs/vercel, @astrojs/netlify, or @astrojs/cloudflare.

Runs site.build_command, and fails on an error or a missing output folder.

Runs at the push stage, once per scope, and needs a build.

Other site checks read the built files, so a failed build hides their findings.

Run the build command by hand and fix what it prints. Name the command under site.build_command.

A build that imports a missing template fails the check. Fix the import, or restore that file.

gspot ignore site/build --paths "<path>" --reason "<why>"

Validates every built page with html-validate.

Runs at the push stage, once per scope, and needs a build.

Templates can each be valid and still join into a page with two main elements or a missing label.

Fix the template or the content that writes the markup the rule names.

A template that writes <img src="logo.png"> without alternative text reports a finding in the built HTML. Add alt text in the template, or alt="" for a decorative image.

gspot ignore site/html-validate --paths "<path>" --reason "<why>"
gspot ignore site/html-validate --rule <rule> --reason "<why>"

To silence one place, write a comment such as:

<!-- [html-validate-disable-next no-inline-style -- reason: the email client strips classes] -->

Finds unused selectors from the scope’s stylesheets in the built CSS.

Runs at the push stage, once per scope, and needs a build.

Visitors download an unused selector, and maintainers still read it.

Delete the rule, or list a name a script adds at run time under site.allowed_classes with a reason.

A built .unused-banner selector that no page or script uses reports a finding. Delete the rule, or list a class that a script adds under site.allowed_classes with a reason.

gspot ignore site/purgecss --paths "<path>" --reason "<why>"

Checks the links between built pages, stylesheets, and fragments without a server or network requests.

Runs at the push stage, once per scope, and needs a build.

A visitor hits a broken internal link before the author notices it.

Fix the link, or the page it points at.

A link to /missing/ reports a broken destination when that page does not exist. Point it at an existing page, or add the page.

gspot ignore site/lychee --paths "<path>" --reason "<why>"
gspot ignore site/lychee --rule <rule> --reason "<why>"

Compares the sitemap with the built pages, and reports a listed route with no page or a page left out.

Runs at the push stage, once per scope, and needs a build.

Search engines find an unlisted page late, and get an error for a listed route with no page.

Add the page to the sitemap, remove the dead URL, or leave a page out under site.allowed_unlisted_pages.

A sitemap URL for /removed/ with no built page reports a stale route. Remove it from the sitemap source, and rebuild.

Rule What it checks What to do
missing-page Each URL of the sitemap has a page in the build. Remove the URL from the sitemap, or build the page.
unlisted-page The sitemap lists each page that the build writes, except site.allowed_unlisted_pages. Add the page to the sitemap, or list its path under site.allowed_unlisted_pages.
invalid-url Each <loc> of the sitemap holds an absolute URL with valid escapes. Write the full URL, such as https://example.com/about/, with its special characters escaped.
gspot ignore site/sitemap --paths "<path>" --reason "<why>"
gspot ignore site/sitemap --rule missing-page --reason "<why>"

Finds files under an assets folder that no page, stylesheet, or script names.

Runs at the push stage, once per scope.

An asset that no page names still ships with every deploy.

Delete the file.

An image that no built page or stylesheet references reports an unused asset. Delete it from the source assets, and rebuild.

Rule What it checks What to do
unused-asset No page, stylesheet, or script names a file under an assets folder. Delete the file, or name it in the page, stylesheet, or script that loads it.
gspot ignore site/unused-assets --paths "<path>" --reason "<why>"
gspot ignore site/unused-assets --rule unused-asset --reason "<why>"
Setting What it sets
site.build_command The command that builds the site. Without it, gspot runs the build script with the package manager of the repository.
site.build_folder The folder the build writes.
site.allowed_classes Class names that a script adds at run time, which the unused CSS check keeps.
site.allowed_unlisted_pages Built pages the sitemap leaves out on purpose.
Rule file Installed when
.gspot/rules/SITE.md Always
Tool Version
lychee 0.24.2
purgecss 8.0.0

.gspot/configurations/site/html-validate.json, .gspot/configurations/site/purgecss-safelist.json, and .gspot/configurations/site/purgecss.mjs