skip to Main Content

The SEO tags don’t get rendered in SSR when using the next-seo package.
I have tried

<NextSeo />

and

<Head><NextSeo /></Head>

to render code in a next.js page, but no luck.

Can anyone have any workaround solutions by using next-seo with SSR?

Thanks.

2

Answers


  1. Chosen as BEST ANSWER

    I've just found that the reason is <PersistGate loading={null} persistor={persistor}></PersistGate>. Because I am using redux and persist-redux in react.

    If I take out the <PersistGate> line, the meta tags are fine.

    _app.js:

        return (
            <Provider store={store}>
                <PersistGate loading={null} persistor={persistor}>
                    <StylesProvider>
                        <ThemeProvider theme={theme}>
                            <CssBaseline />
                            <Component {...pageProps} />
                        </ThemeProvider>
                    </StylesProvider>
                </PersistGate>
            </Provider>
        );
    

    What is the problem there? I must use redux+persist-redux....


  2. In my case works only like this:

    <>
       <NextSeo
                title={titleSEO}
                description={descriptionSEO}
                openGraph={openGraph}
       />
       <Head>
                <link rel="icon" href="/favicon.ico"/>
       </Head>
       ...
    </>
    
    • next: 12.1.4 in SSR mode
    • next-seo: 5.5.0
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search