Something went wrong. Try again.
🌿 Collaborative wiki on ATProto lichen.wiki
atmosphere social atproto app
Something went wrong. Try again.
1.3 kB · 57 lines
TypeScript
at main
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758interface 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<string, unknown> { 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, }, ], }, ], };}