nextjs-react-router icon indicating copy to clipboard operation
nextjs-react-router copied to clipboard

Incompatible with NextSEO and next/head

Open shelbyt opened this issue 3 years ago • 1 comments

If you try to add metatags to the server side rendered pages it does not show up in page source and will not get picked up by any social media crawlers. It seems to be because of the null in this line:

{typeof window === 'undefined' ? null : <Component {...pageProps} />}

But I don't know if there is any way around this because that window check is required.

shelbyt avatar May 31 '21 00:05 shelbyt

If you want to modify the head for all pages you can use next-seo and include a default next-seo.config.ts file see code sandbox here: https://codesandbox.io/s/tiess?file=/next-seo.config.ts.

but you still can't change the metatags for a single SSR'd page (such as settings.ts in the example)

shelbyt avatar May 31 '21 13:05 shelbyt