Skip to content

Post Processing

This page details configuration options for adding or removing properties from the sitemap after it has been generated, via rules and explicit overrides.

The pageTitles option allows you to explicitly set the title of a specific endpoint/URL as the node title. Normally, the node title is either derived from the frontmatter title field, or the most common label associated with the link.

If you specify a title for a page in the pageTitles object, it will override the default behavior.

Sitemap with no custom page titles.

{}

When a page does not have a title explicitly specified in the frontmatter or in the pageTitles option, the plugin will use a fallback strategy to determine the title of the page.

There are currently two fallback strategies available:

Use the most common link label associated with the page.

src/content/docs/my-page.md
[A page](/another-page) link.
It has [important info](/another-page).
Very [important info](/another-page).
astro.config.mjs
export default defineConfig({
integrations: [
starlight({
plugins: [
starlightSiteGraph({
sitemapConfig: {
pageTitleFallbackStrategy: "linkText",
},
})
],
}),
],
})
sitemap.json
{
"another-page/": {
"external": false,
"exists": true,
"title": "Important Info",
...
}
}

The styleRules option allows you to specify a set of rules that will be applied to pages based on their resource path. The rules are specified as a list of strings, where each string is a glob pattern. The first rule that matches the file path will be applied to the page.

If a custom style was specified in the page’s frontmatter, it will override the style rule, otherwise, these styles have precedence over all other styles.

Sitemap with no style rules applied.

{}

The tagRules option allows you to specify a set of rules which will add tags to pages based on their resource path. The rules are specified as a list of strings, where each string is a glob pattern. The first rule that matches the file path will be applied to the page.

Sitemap with no tag rules applied.

{
"tagRenderMode": "node"
}