react-meta-tags icon indicating copy to clipboard operation
react-meta-tags copied to clipboard

Script tag JSON-LD render twice!

Open Alchy-web opened this issue 5 years ago • 1 comments

I have included the <MetaTags> in my JSX. Why does my script tag render twice?

the first script tag returns undifined values, and the second one returns the correct values, i have added async & defer to my script tag but in vain!!

<MetaTags>
            <script type="application/ld+json">
            {`
              {
                "@context": "https://schema.org/",
                "@type": "CreativeWorkSeries",
                "name": "${this.state.name}",
                "aggregateRating": {
                  "@type": "AggregateRating",
                  "ratingValue": "${this.state.rating}",
                  "bestRating": "5",
                  "ratingCount": "${this.state.count}"
                }
              }
            `}
            </script>
</MetaTags>

Alchy-web avatar Jun 01 '20 16:06 Alchy-web

I opened a PR to fix this: https://github.com/s-yadav/react-meta-tags/pull/35

bertyhell avatar Jul 03 '20 14:07 bertyhell