How to use ClientRouter? #2823
Answered
by
delucis
shinebayar-g
asked this question in
Q&A
-
I've created a head component based on the built in Head.astro component like this // src/components/Head.astro
---
import type { Props } from "@astrojs/starlight/props";
import StarlightHead from "@astrojs/starlight/components/Head.astro";
import { ClientRouter } from "astro:transitions";
---
<StarlightHead {...Astro.props}>
<slot />
<ClientRouter />
</StarlightHead> However, client side router is not enabled. How can I enable client router for starlight? |
Beta Was this translation helpful? Give feedback.
Answered by
delucis
Jan 22, 2025
Replies: 1 comment 3 replies
-
👋 The default Changing the code of your component override to the following should work: <StarlightHead {...Astro.props}><slot /></StarlightHead>
<ClientRouter /> |
Beta Was this translation helpful? Give feedback.
3 replies
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
I think you might need the
astro-vtbot
package. Without it, you would need to confirm that things like search and the mobile menu still work after navigation. Last time I tried, I think some of these could break after navigating between pages with Astro’s client router enabled.