Skip to content

Commit b023748

Browse files
committed
fixup! Add automatic JSON-LD schema generation for docs
1 parent e3ad352 commit b023748

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/components/Head.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,16 @@ export const Head = ({
2828
{keywords && <meta name="keywords" content={keywords} />}
2929

3030
{/* JSON-LD Structured Data */}
31-
{jsonLd && (
32-
Array.isArray(jsonLd) ? (
31+
{jsonLd &&
32+
(Array.isArray(jsonLd) ? (
3333
jsonLd.map((schema, index) => (
3434
<script key={`jsonld-${index}`} type="application/ld+json">
3535
{serializeJsonLd(schema)}
3636
</script>
3737
))
3838
) : (
39-
<script type="application/ld+json">
40-
{serializeJsonLd(jsonLd)}
41-
</script>
42-
)
43-
)}
39+
<script type="application/ld+json">{serializeJsonLd(jsonLd)}</script>
40+
))}
4441

4542
<link rel="preconnect" href="https://fonts.googleapis.com" />
4643
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" />

src/components/Layout/MDXWrapper.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,14 @@ const MDXWrapper: React.FC<MDXWrapperProps> = ({ children, pageContext, location
237237

238238
return (
239239
<SDKContext.Provider value={{ sdk, setSdk }}>
240-
<Head title={title} metaTitle={metaTitle} canonical={canonical} description={description} keywords={keywords} jsonLd={jsonLd} />
240+
<Head
241+
title={title}
242+
metaTitle={metaTitle}
243+
canonical={canonical}
244+
description={description}
245+
keywords={keywords}
246+
jsonLd={jsonLd}
247+
/>
241248
<Article>
242249
<MarkdownProvider
243250
components={{

0 commit comments

Comments
 (0)