Skip to content

Commit

Permalink
fix: invalid structured data ld+json
Browse files Browse the repository at this point in the history
  • Loading branch information
lucymtc committed Jan 27, 2024
1 parent d43a409 commit 2ff79a9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/shiny-lamps-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@headstartwp/next": patch
---

Fix invalid structured data ld+json
13 changes: 10 additions & 3 deletions packages/next/src/components/Yoast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,16 @@ export function Yoast({ seo, useHtml = false }: Props) {
domNode.firstChild &&
isTextElement(domNode.firstChild)
) {
domNode.firstChild.data = domNode.firstChild.data.replace(
new RegExp(sourceUrl, 'g'),
hostUrl,
return (
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: domNode.firstChild.data.replace(
new RegExp(sourceUrl, 'g'),
hostUrl,
),
}}
/>
);
}

Expand Down

0 comments on commit 2ff79a9

Please sign in to comment.