Top And Bottom Table of Contents Wrapper
You can also display content above and below the Table of Contents at the same time.
Here is an example:
-
Create the component
TableOfContents.astro
:src/components/TableOfContents.astro ---import Default from '@astrojs/starlight/components/TableOfContents.astro'import TopTableOfContentsWrapper from 'starlight-cooler-credit/components/TopTableOfContentsWrapper.astro'import BottomTableOfContentsWrapper from 'starlight-cooler-credit/components/BottomTableOfContentsWrapper.astro'---<TopTableOfContentsWrapper><p>β¨ Reaching for the stars! β¨</p></TopTableOfContentsWrapper><Default><slot /></Default><BottomTableOfContentsWrapper><p>Hello, Astronaut! π¨βπ</p></BottomTableOfContentsWrapper> -
Override the default
TableOfContents
component in yourastro.config.mjs
:astro.config.mjs export default defineConfig({integrations: [starlight({components: {TableOfContents: "./src/components/TableOfContents.astro",},}),],});
You can see the result in the right Table of Contents (if youβre not on a mobile device) β‘οΈ