Reputation: 123610
I am using Svero to do routing in Svelte. I have the following set up per the Svero docs:
<Router>
<Route path="/" component={FrontPage} />
<Route path="/pricing" component={Pricing} />
<Route path="/about" component={About} />
<Route path="/*" component={ErrorPage}>
</Router>
Note I do not wish to have / be the same route as errors (as shown in the docs)
This has the following side effects:
FrontPage
contentFrontPage
content followed by the Pricing
contentFrontPage
content followed by the About
contentHow can I make a route specifically for / with content that does not show up on other routes? How can I have a working fallback route?
Note I have tried path="/$"
in case Svero supports RegExs, and it didn't work.
Upvotes: 1
Views: 386
Reputation: 123610
Turns out this is actually a bug in Svero. The config below includes a workaround:
<Router>
<!-- See https://github.com/kazzkiq/svero/issues/43 /> -->
<Route exact path="" fallback component={FrontPage} />
<Route path="/about" component={About} />
<Route path="*" component={ErrorPage} error={window.serverVars.error}/>
</Router>
Upvotes: 1