Skip to content

Commit

Permalink
feat: add episode structured data
Browse files Browse the repository at this point in the history
  • Loading branch information
w3cj committed Nov 14, 2024
1 parent 391638e commit 1056fb2
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/routes/(site)/show/[show_number]/[slug]/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,31 @@
function variable_svg(node: HTMLElement) {
replace_color(node);
}
const showSchema = {
'@context': 'https://schema.org/',
'@type': 'PodcastEpisode',
url: $page.url,
name: show.title,
datePublished: format(show.date, 'yyyy-LL-dd'),
// TODO: add duration once we are saving it
// timeRequired: 'PT37M',
description: show.aiShowNote?.description,
associatedMedia: {
'@type': 'MediaObject',
contentUrl: show.url
},
partOfSeries: {
'@type': 'PodcastSeries',
name: 'Syntax',
url: 'https://syntax.fm'
}
};
</script>

<svelte:head>
{@html `<script type="application/ld+json">\n${JSON.stringify(showSchema, null, 2)}\n</script>`}
</svelte:head>
<header>
<span
title="Show #{show.number}"
Expand Down

0 comments on commit 1056fb2

Please sign in to comment.