grain.social is a photo sharing platform built on atproto.
1import { Record as Gallery } from "$lexicon/types/social/grain/gallery.ts"; 2import { GalleryView } from "$lexicon/types/social/grain/gallery/defs.ts"; 3import { isPhotoView } from "$lexicon/types/social/grain/photo/defs.ts"; 4import { AtUri } from "@atproto/syntax"; 5import { MetaDescriptor } from "@bigmoves/bff/components"; 6import { PUBLIC_URL } from "./env.ts"; 7import { galleryLink } from "./utils.ts"; 8 9export function getPageMeta(pageUrl: string): MetaDescriptor[] { 10 return [ 11 { 12 tagName: "link", 13 property: "canonical", 14 href: `${PUBLIC_URL}${pageUrl}`, 15 }, 16 { property: "og:site_name", content: "Grain Social" }, 17 ]; 18} 19 20export function getGalleryMeta(gallery: GalleryView): MetaDescriptor[] { 21 return [ 22 // { property: "og:type", content: "website" }, 23 { 24 property: "og:url", 25 content: `${PUBLIC_URL}${ 26 galleryLink( 27 gallery.creator.handle, 28 new AtUri(gallery.uri).rkey, 29 ) 30 }`, 31 }, 32 { property: "og:title", content: (gallery.record as Gallery).title }, 33 { 34 property: "og:description", 35 content: (gallery.record as Gallery).description, 36 }, 37 { 38 property: "og:image", 39 content: gallery?.items?.filter(isPhotoView)?.[0]?.fullsize, 40 }, 41 ]; 42}