PCK
PCK

Reputation: 1444

react-snap not detecting all routes

  <BrowserRouter>
        <Switch>
            <Route
                exact
                path="/"
                component={EmailVerification}
            />
            <Route exact path={urlConfig.cashback} component={Cashback} /> 

            <Route
                exact
                path={urlConfig.emailVerificationFailure}
                component={EmailVerification}
            />
       </Switch>
  </BrowserRouter>

This is my routes. When I am using react-snap post build, only the first route gets crawled, not the other routes.

This is my package.json

   "reactSnap": {
    "inlineCss": true,
    "fixWebpackChunksIssue": false
}

Can anyone let me know what could be the issue?

Upvotes: 1

Views: 2791

Answers (1)

Greg Wozniak
Greg Wozniak

Reputation: 7232

Did you actually have these routes linked somewhere? Crawler (headless Chrome) analyses HTML structure. If you haven't linked these pages anywhere it won't know they exist. Try to add <a href="/emailverificationfailure">test</a> to your page and I am pretty sure it will get crawled. The real question is - why do you want it to be crawled?

The purpose of pre-rendering is mostly SEO, the Google Bot or crawler will use the same technique to crawl. You don't want to index your Email Verification Failure page, right?

If you want that page to still work, it should as your app.js file is still there.

Upvotes: 2

Related Questions