blog/frontend/src/lib/post/framework/ui/StructuredData.svelte
SquidSpirit c1caa10f2c
All checks were successful
PR Title Check / pr-title-check (pull_request) Successful in 16s
Frontend CI / build (push) Successful in 1m4s
BLOG-48 fix: eslint
2025-08-05 05:55:03 +08:00

31 lines
602 B
Svelte

<script lang="ts">
/* eslint-disable svelte/no-at-html-tags */
const {
headline,
description,
datePublished,
image
}: {
headline: string;
description: string;
datePublished: Date;
image: URL;
} = $props();
const structuredData = $derived({
'@context': 'https://schema.org',
'@type': 'BlogPosting',
headline: headline,
description: description,
datePublished: datePublished.toISOString(),
image: image.href
});
const jsonLdScript = $derived(
`<script type="application/ld+json">${JSON.stringify(structuredData)}${'<'}/script>`
);
</script>
{@html jsonLdScript}