Unlisted Pages
By default, the Starlight Sidebar Topics plugin expect that every content pages in your project is associated with a topic. This is done by including the content page in a topic sidebar configuration and the plugin will automatically determine which sidebar to display based on the current page.
However, there are cases where you may want to have a content page that is not listed in any topic sidebar while still displaying the sidebar of a specific topic.
Configure content collections
Starlight is built on top of Astro’s content collections, which are configured in the src/content/config.ts
file.
To add support for unlisted content pages, update the content config file to add support for associating content pages with a specific topic:
Create a topic ID
To associate an unlisted content page with a specific topic, the topic must define an id
in its configuration:
Associate a page with a topic
To associate an unlisted content page with a specific topic, you can use the topic
frontmatter field in the page’s content file:
For example, given the following file structure based on this guide:
Directorysrc/
Directorycontent/
Directorydocs/
Directoryguides/
- concepts.md
- courses.md
- support.md
Visiting the guides/concepts
, guides/courses
, and guides/support
pages will all display the sidebar of the “Guides” topic.
guides/concepts
andguides/courses
are explicitly listed in the “Guides” topic sidebar configuration under theitems
key.guides/support
is not listed in the “Guides” topic sidebar configuration but is associated with the “Guides” topic through thetopic: guides
frontmatter entry.