-
We have a Layout component that all Page Components use. This Layout component has all the meta tags that are populated from an API call. Within that Layout, we have css/js script/link tags including our Tag Manager (which has to be loaded synchronously and right after the meta-tags). We are finding that we have meta-tags being rebuilt when the page loads in the browser, causing duplicate meta-tags. When we remove the TMS, the duplicate tags go away. If we switch the order of the TMS to a lower part of the load, duplicates go away but then it is too low in the order for some scripts to work properly like A/B testing tools. Any thoughts on how to resolve this? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Hi @jaybytez. You may want to look at adding a
<Head>
<meta property="og:title" content="My page title" key="title" />
</Head> |
Beta Was this translation helpful? Give feedback.
-
@jamesmosier After some testing, it appears that issue is not our Tag Manager, it is just our Tag Manager exposes the issue. The Tag Manager runs sync in the Head and adds script (configured into the tool) to the Head, when it does this, it causes the React/Head to regenerate meta tags. We replicated it by removing the Tag Manager and adding a local script to the Head that basically does this:
Each time we add an element to the Head, another meta tag is duplicated into the HTML. The more document.head.append actions, the more meta-tags are being duplicated. |
Beta Was this translation helpful? Give feedback.
-
Google Tag Manager snippet code was inserted in my case at the end of other meta tags, which caused the same problem. |
Beta Was this translation helpful? Give feedback.
@jamesmosier After some testing, it appears that issue is not our Tag Manager, it is just our Tag Manager exposes the issue. The Tag Manager runs sync in the Head and adds script (configured into the tool) to the Head, when it does this, it causes the React/Head to regenerate meta tags.
We replicated it by removing the Tag Manager and adding a local script to the Head that basically does this: