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.
Selected when
Section titled “Selected when”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.
Checks
Section titled “Checks”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.
What to do
Section titled “What to do”Run the build command by hand and fix what it prints. Name the command under site.build_command.
Example
Section titled “Example”A build that imports a missing template fails the check. Fix the import, or restore that file.
Turn it off
Section titled “Turn it off”gspot ignore site/build --paths "<path>" --reason "<why>"html-validate
Section titled “html-validate”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.
What to do
Section titled “What to do”Fix the template or the content that writes the markup the rule names.
Example
Section titled “Example”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.
Turn it off
Section titled “Turn it off”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] -->purgecss
Section titled “purgecss”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.
What to do
Section titled “What to do”Delete the rule, or list a name a script adds at run time under site.allowed_classes with a reason.
Example
Section titled “Example”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.
Turn it off
Section titled “Turn it off”gspot ignore site/purgecss --paths "<path>" --reason "<why>"lychee
Section titled “lychee”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.
What to do
Section titled “What to do”Fix the link, or the page it points at.
Example
Section titled “Example”A link to /missing/ reports a broken destination when that page does not exist. Point it at an existing page, or add the page.
Turn it off
Section titled “Turn it off”gspot ignore site/lychee --paths "<path>" --reason "<why>"gspot ignore site/lychee --rule <rule> --reason "<why>"sitemap
Section titled “sitemap”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.
What to do
Section titled “What to do”Add the page to the sitemap, remove the dead URL, or leave a page out under site.allowed_unlisted_pages.
Example
Section titled “Example”A sitemap URL for /removed/ with no built page reports a stale route. Remove it from the sitemap source, and rebuild.
Lint rules
Section titled “Lint rules”| 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. |
Turn it off
Section titled “Turn it off”gspot ignore site/sitemap --paths "<path>" --reason "<why>"gspot ignore site/sitemap --rule missing-page --reason "<why>"unused-assets
Section titled “unused-assets”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.
What to do
Section titled “What to do”Delete the file.
Example
Section titled “Example”An image that no built page or stylesheet references reports an unused asset. Delete it from the source assets, and rebuild.
Lint rules
Section titled “Lint rules”| 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. |
Turn it off
Section titled “Turn it off”gspot ignore site/unused-assets --paths "<path>" --reason "<why>"gspot ignore site/unused-assets --rule unused-asset --reason "<why>"Settings
Section titled “Settings”| 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. |
Rules for coding agents
Section titled “Rules for coding agents”| Rule file | Installed when |
|---|---|
.gspot/rules/SITE.md |
Always |
Tools and versions
Section titled “Tools and versions”| Tool | Version |
|---|---|
| lychee | 0.24.2 |
| purgecss | 8.0.0 |
Files gspot writes
Section titled “Files gspot writes”.gspot/configurations/site/html-validate.json, .gspot/configurations/site/purgecss-safelist.json, and .gspot/configurations/site/purgecss.mjs