g3ts-astro-sitemap-auditor
v0.1.5
Published
Post-build sitemap XML auditor for Astro output.
Downloads
54
Maintainers
Readme
g3ts-astro-sitemap-auditor
Astro integration that audits generated sitemap XML after astro build.
This package validates generated sitemap XML from Astro output. It is not an ESLint plugin and not a sitemap generator.
Install
npm add -D g3ts-astro-sitemap-auditorAstro Usage
import { defineConfig } from "astro/config";
import sitemap from "@astrojs/sitemap";
import g3tsSitemapAuditor from "g3ts-astro-sitemap-auditor";
export default defineConfig({
site: "https://example.com",
integrations: [
sitemap(),
g3tsSitemapAuditor({
site: "https://example.com",
trailingSlash: "always"
})
]
});Library Usage
import { checkSitemap } from "g3ts-astro-sitemap-auditor";
const result = await checkSitemap({
site: "https://example.com",
trailingSlash: "always",
outputDir: "dist"
});
if (!result.ok) {
console.error(result.findings);
process.exitCode = 1;
}Checks
- XML parses with a real XML parser.
- Sitemap index recursion is followed.
- Every
locuses the configured HTTPS host exactly. - No
locuseshttp. - No
locuses a foreign host. - Bare and
wwwhost variants are not mixed. - Duplicate
locvalues are rejected. - Slash/no-slash pairs for the same path are rejected.
- Sitemap URLs follow the configured trailing-slash policy.
- Built HTML pages are present in the sitemap unless explicitly allowed.
- Sitemap page URLs map to built HTML pages unless explicitly allowed.
Non-Responsibilities
- Does not infer routes from source files.
- Does not inspect Astro collections.
- Does not generate sitemap XML.
- Does not expose a CLI.
- Does not mutate final output.
- Does not validate page links.
- Does not validate
robots.txtorllms.txt.
