Next JS - Meta Tags Missing in Source Code

Viewed 3310

I have installed multiple meta tags such as title, description, keywords, etc.

However it is not showing these tags in view source. Therefore Facebook sharing cards are not working (I have installed og tags but they seem no where to be found on Facebook's Scraper or my view source. However it is populate on Client Slide.

My Head Format (Show Tags in Client Inspect / DevTools but not in View Source):

import Head from 'next/head';

export default () => (
  <>
    <Head>
      <meta property="og:title" content={title} />
      <meta property="og:url" content={url} />
    </Head>
    <Header />
    <Body />
    <Footer />
  </>
)

Output (Redacted Page Props):


<!DOCTYPE html><html><head><style data-next-hide-fouc="true">body{display:none}</style><noscript data-next-hide-fouc="true"><style>body{display:block}</style></noscript><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/_next/static/development/pages/_app.js?ts=1592258092029" as="script"/><link rel="preload" href="/_next/static/development/pages/Home.js?ts=1592258092029" as="script"/><link rel="preload" href="/_next/static/runtime/webpack.js?ts=1592258092029" as="script"/><link rel="preload" href="/_next/static/runtime/main.js?ts=1592258092029" as="script"/><noscript id="__next_css__DO_NOT_USE__"></noscript></head><body><div id="__next"></div><script src="/_next/static/runtime/react-refresh.js?ts=1592258092029"></script><script src="/_next/static/development/dll/dll_f9de5cbc314a1e41f91e.js?ts=1592258092029"></script><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps": "page":"/Home","query":{},"buildId":"development","isFallback":false,"gssp":true}</script><script nomodule="" src="/_next/static/runtime/polyfills.js?ts=1592258092029"></script><script async="" data-next-page="/_app" src="/_next/static/development/pages/_app.js?ts=1592258092029"></script><script async="" data-next-page="/Home" src="/_next/static/development/pages/Home.js?ts=1592258092029"></script><script src="/_next/static/runtime/webpack.js?ts=1592258092029" async=""></script><script src="/_next/static/runtime/main.js?ts=1592258092029" async=""></script><script src="/_next/static/development/_buildManifest.js?ts=1592258092029" async=""></script><script src="/_next/static/development/_ssgManifest.js?ts=1592258092029" async=""></script></body></html>
1 Answers

The problem seems to be from Redux Persist which disables SSR. Disabling PersistGate server side seems to fix the issue.

Github Issue Link

return process.browser ? (
        <PersistGate persistor={store.__persistor} loading={<div>Loading</div>}>
            <ToastProvider>
                <Component {...pageProps} />
            </ToastProvider>
        </PersistGate>
    ) : (
            <Provider store={store}>
                <ToastProvider>
                    <Component {...pageProps} />
                </ToastProvider>
            </Provider>
        );
Related