Reputation: 8063
I'm trying to set up netlify prerendering with a react + react router + react helmet app. I'm trying to display the page title in the tag and some open graph meta tags when a page is crawled.
Here's the code calling react-helmet:
<Helmet>
<title>{entry.title} — Road Trip en Islande</title>
<meta name="description" content="Nested component" />
<meta property="og:title" content={entry.title} />
<meta property="og:url"
content={`https://roadtrips.iwazaru.fr/entry/${entry.id}`} />
</Helmet>
It does work in the browser without prerendering: https://roadtrips.iwazaru.fr/entry/S
It also works when prerending locally using netlify prerender, the correct title and open graph tags show up in the prerendered html.
But when crawling the page with the facebook debugger, nothing that I put in react helmet seems to be prerendered although the rest of the page is correctly prerendered: https://developers.facebook.com/tools/debug/echo/?q=https%3A%2F%2Froadtrips.iwazaru.fr%2Fentry%2FS
Am I doing something wrong ?
Upvotes: 2
Views: 3140
Reputation: 8063
Solved it. The problem was apparently that there were open graph meta tags in the index.html
template file, loaded before react-helmet. I still can't explain why they would be replaced when using prerender locally and not when using netlify's prerender.
Upvotes: 1