Inclusion
This page details configuration options for changing what is included in the sitemap.
Content Root
The contentRoot
option specifies from which directory files should be parsed to generate the sitemap.
By default, this is set to ./src/content/docs
. If you have your pages stored elsewhere, you will likely have to change this option.
Example:
Directorysrc
Directorycontent
Directorydocs
Directoryprivate These files are included in the sitemap
- basic-secretive-page.md
- reactive-hidden-page.mdx
- yet-another-special-page.mdoc
- astronomically-exclusive.astro
- …
Directorypublic These files are included in the sitemap
- index.md
- about.mdx
- contact.mdoc
- faq.astro
- …
Directorysrc
Directorycontent
Directorydocs
Directoryprivate These files are not included in the sitemap
- basic-secretive-page.md
- reactive-hidden-page.mdx
- yet-another-special-page.mdoc
- astronomically-exclusive.astro
- …
Directorypublic These files are included in the sitemap
- index.md
- about.mdx
- contact.mdoc
- faq.astro
- …
Page Inclusion Rules
The pageInclusionRules
option allows you to specify which pages should be included in the sitemap based on their file path.
The rules are specified as a list of strings, where each string is a glob pattern.
The first rule that was matched, determines whether the page is included or not.
If the inclusion of a page was specified in its frontmatter, it will take precedence over the rules specified here.
All files are included in the sitemap.
Directorysrc
Directorycontent
Directorydocs
Directoryprivate
- basic-secretive-page.md
- reactive-hidden-page.mdx
- yet-another-special-page.mdoc
- astronomically-exclusive.astro
- …
Directorypublic
- index.md
- about.mdx
- contact.mdoc
- faq.astro
- …
Only normal markdown files are included in the sitemap.
Directorysrc
Directorycontent
Directorydocs
Directoryprivate
- basic-secretive-page.md
- reactive-hidden-page.mdx
- yet-another-special-page.mdoc
- astronomically-exclusive.astro
- …
Directorypublic
- index.md
- about.mdx
- contact.mdoc
- faq.astro
- …
Only files in the public
directory are included.
Directorysrc
Directorycontent
Directorydocs
Directoryprivate
- basic-secretive-page.md
- reactive-hidden-page.mdx
- yet-another-special-page.mdoc
- astronomically-exclusive.astro
- …
Directorypublic
- index.md
- about.mdx
- contact.mdoc
- faq.astro
- …
No files are included, because the first rule is always matched first.
Directorysrc
Directorycontent
Directorydocs
Directoryprivate
- basic-secretive-page.md
- reactive-hidden-page.mdx
- yet-another-special-page.mdoc
- astronomically-exclusive.astro
- …
Directorypublic
- index.md
- about.mdx
- contact.mdoc
- faq.astro
- …
Only files that are not .mdoc
files are included.
Directorysrc
Directorycontent
Directorydocs
Directoryprivate
- basic-secretive-page.md
- reactive-hidden-page.mdx
- yet-another-special-page.mdoc
- astronomically-exclusive.astro
- …
Directorypublic
- index.md
- about.mdx
- contact.mdoc
- faq.astro
- …
Ignore Starlight Links
By default, Starlight adds additional links to every page, such as the “Edit this page”, “Built with Starlight”,
and icons links. Since this is not necessarily useful (meaningful) for the graph, as it will
clutter pages together, you can choose to ignore these types of links via the ignoreStarlightLinks
option -
this setting is true
by default.
Here are all the types of links that are ignored:
Edit this page
(created byeditLink: { 'baseUrl': '...' }
)Built with Starlight
(created bycredits: true
)- Social links (created by
social: { ... }
) - Pagination links connecting previous and next pages (created by
pagination: true
) - Links to the landing page/root page (always added for title)
These ignores are added as part of the linkInclusionRules
configuration.
If you want to override the behaviour (i.e. keep a link that would otherwise be ignored),
you can do so by specifying the link as a positive rule in the linkInclusionRules
configuration
(without a !
prefix).
As an example, specifying linkInclusionRules: ["https://starlight.astro.build", "**/*"]
will result in the
credits link not being ignored.
Finally, if you are not using Starlight, this setting will have no effect.
Link Inclusion Rules
The linkInclusionRules
option allows you to specify which links should be included in the sitemap based on their target path.
The rules are specified as a list of strings, where each string is a glob pattern.
The first rule that was matched, determines whether the link is included or not.
If a link was specified in the frontmatter of a page, it will always be included, regardless of the rules specified here.
All links are matched.
Only links that end in /link
are matched.
Only links to the here
subdirectory are matched.
Only links that are not external are matched. This is equivalent to includeExternalLinks: false
.
Include External Links
The includeExternalLinks
option toggles whether external links will be included in the sitemap.