Reputation: 349
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.
Upvotes: 1
Views: 1351
Reputation: 1527
In my case works only like this:
<>
<NextSeo
title={titleSEO}
description={descriptionSEO}
openGraph={openGraph}
/>
<Head>
<link rel="icon" href="/favicon.ico"/>
</Head>
...
</>
Upvotes: 0
Reputation: 349
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....
Upvotes: 1