-
What I want: A contents listing on my home page, following the same structure as the sidebar, formatted a very different way. I could do this with the Sidebar/SidebarSublist and some corrective CSS. But I can't get them to render directly. I assume the MDX doesn't have the same environment, and it's not being passed through (I'm not sure how I'd do that from MDX). So any ideas? I tried making a I don't want to do this manually and have to update it and the sidebar every time there's a change. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
👋 Thanks for your question. This is something that can be achieved using component overrides which allow you to replace the components used by Starlight with your own custom components. When overriding a Starlight component, your custom component receives a standard object ( In your specific case, one solution could be to override the I tried to give links to the relevant parts of the documentation for each steps but here is also a small StackBlitz example that demonstrates how to achieve this. This would require some more work based on your specific needs, your sidebar structure and how you want to render it but this should give you a good starting point. |
Beta Was this translation helpful? Give feedback.
👋 Thanks for your question.
This is something that can be achieved using component overrides which allow you to replace the components used by Starlight with your own custom components. When overriding a Starlight component, your custom component receives a standard object (
Astro.props
) containing all the data for the current page (which includes the sidebar data)In your specific case, one solution could be to override the
<MarkdownContent/>
component which is rendered around each page’s main content. If the page is the hompage, render something totally diferent that is re-using the sidebar data. If this is not, render the defaultMarkdownContent
component from Starlight.I tried to give…