1
  <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?

PCK
  • 1,254
  • 6
  • 20
  • 37

1 Answers1

2

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.

Greg Wozniak
  • 5,209
  • 3
  • 26
  • 29
  • The snippet mentioned here is just for demonstrative purposes. So, please assume that the route is some route that actually needs to be crawled. What if I don't have anchor tags that point to the said route inside my application? In that case, react-snap wouldn't work? – PCK May 24 '20 at 09:48
  • react-snap crawls post-build code so it doesn't know what did you put in your react router. Your `app.js` file should be built already by webpack for example. If you choose cloud-prerender it's precisely the same. Crawler jumps on your page (imagine it's a user) and goes where it can to produce the result. – Greg Wozniak May 24 '20 at 10:34