Skip to content

Very confused on how SEO (Crawlers) work with NextJS #41754

Answered by icyJoseph
k2xl asked this question in Help

You must be logged in to vote

There might be an issue with your page because the source always has the entire first server frame rendered. I often test Next.js Apps from Postman, a REST Client, curl, or with JS turned off. Remove the browser from the equation to analyze what bare SEO bots see.

Perhaps you are doing something like show/setShow inside a use-effect that's preventing SSR from reaching that code?

const Example = () => {
  const [show, setShow] = useState(false)
  useEffect(() => { setShow(true) },[])

 return (
    <div>
       {show && <p>foo</p>}
    </div>
 )
}

The above SSR's a div with no children, then in the client after hydration, the effect runs, show is set, and the p tag is added.

Next.js genera…

Replies: 2 comments 2 replies

You must be logged in to vote
2 replies
@k2xl

@icyJoseph

Answer selected by k2xl

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants