[X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
[X] I have removed any sensitive information from my code snippets and submission.
App Id
dspteuym76kn4
AWS Region
us-east-2
Amplify Hosting feature
SSR
Frontend framework
Next.js
Next.js version
^13.4.19
Next.js router
Pages Router
Describe the bug
i use the code in Head tag
<script type="application/ld+json" nonce="xx" dangerouslySetInnerHTML={{ __html: JSON.stringify(data.ld_json) }} />
when firtst visit site, its render twice in head (chrome devtools).
(chrome view-source is render once, that is correct)
And click another page , its render new page dangerouslySetInnerHTML data once and render prev page dangerouslySetInnerHTML data again.
build on localhost is work fine.
Expected behavior
dangerouslySetInnerHTML data render once, and not to render prev page dangerouslySetInnerHTML data when visit another page
search "application/ld+json", You will see two results. But in fact, only one will be taken.(it has only one when check on chrome view-source)
click to visit another page.
application/ld+json of prev page will remain on the page, so The page has its own application/ld+json and the previous page's application/ld+json (check on chrome devtools). its not correct.
Before opening, please confirm:
App Id
dspteuym76kn4
AWS Region
us-east-2
Amplify Hosting feature
SSR
Frontend framework
Next.js
Next.js version
^13.4.19
Next.js router
Pages Router
Describe the bug
i use the code in Head tag
<script type="application/ld+json" nonce="xx" dangerouslySetInnerHTML={{ __html: JSON.stringify(data.ld_json) }} />
when firtst visit site, its render twice in head (chrome devtools). (chrome view-source is render once, that is correct) And click another page , its render new page dangerouslySetInnerHTML data once and render prev page dangerouslySetInnerHTML data again.build on localhost is work fine.
Expected behavior
dangerouslySetInnerHTML data render once, and not to render prev page dangerouslySetInnerHTML data when visit another page
Reproduction steps
Build Settings
No response
Log output
Additional information
No response