NextJs dynamic open graph meta tags not rendering for facebook debugger

拈花ヽ惹草 提交于 2020-08-09 09:47:10

问题


I have tried to include meta tags using base "Head" feature of NextJs, react-helmet and next-seo packages.They all works fine on client side and show meta tags in inspect tool. But When I try to detect it using facebook debugger tool or any other open graph tags detector, it does not work.

May be something to do with server side rendering of meta tags but I have not found enough material to implement server side meta tags in NextJs framework.


回答1:


Are you using Redux Persist?

Since there is a known issue with 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>
        );


来源:https://stackoverflow.com/questions/62041312/nextjs-dynamic-open-graph-meta-tags-not-rendering-for-facebook-debugger

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!