interface NoteArticle { title: string; description: string | null; url: string; image: string; language: string; published: string; modified: string; author: { name: string; url: string | null }; wiki: { name: string; url: string }; } // schema.org for a note page: the article, and the trail from its wiki to it. export function noteStructuredData(note: NoteArticle): Record { return { "@context": "https://schema.org", "@graph": [ { "@type": "Article", headline: note.title, ...(note.description && { description: note.description }), url: note.url, image: note.image, inLanguage: note.language, datePublished: note.published, dateModified: note.modified, author: { "@type": "Person", name: note.author.name, ...(note.author.url && { url: note.author.url }), }, isPartOf: { "@type": "WebSite", name: note.wiki.name, url: note.wiki.url, }, }, { "@type": "BreadcrumbList", itemListElement: [ { "@type": "ListItem", position: 1, name: note.wiki.name, item: note.wiki.url, }, { "@type": "ListItem", position: 2, name: note.title, item: note.url, }, ], }, ], }; }