Skip to content

Commit

Permalink
fix: invalid structured data ld+json (#685)
Browse files Browse the repository at this point in the history
Co-authored-by: Nícholas André <nicholasio.oliveira@gmail.com>
  • Loading branch information
lucymtc and nicholasio authored Jan 27, 2024
1 parent 5854a73 commit 6a35eaa
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

1 comment on commit 6a35eaa

@vercel
Copy link

@vercel vercel bot commented on 6a35eaa Jan 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.