grain.social is a photo sharing platform built on atproto.
at main 1.2 kB view raw
1import { GalleryView } from "$lexicon/types/social/grain/gallery/defs.ts"; 2import { AtUri } from "@atproto/syntax"; 3import { MetaDescriptor } from "@bigmoves/bff/components"; 4import { PUBLIC_URL } from "./env.ts"; 5import { galleryLink } from "./utils.ts"; 6 7export function getPageMeta(pageUrl: string): MetaDescriptor[] { 8 return [ 9 { 10 tagName: "link", 11 property: "canonical", 12 href: `${PUBLIC_URL}${pageUrl}`, 13 }, 14 { property: "og:site_name", content: "Grain Social" }, 15 ]; 16} 17 18export function getGalleryMeta(gallery: GalleryView): MetaDescriptor[] { 19 return [ 20 // { property: "og:type", content: "website" }, 21 { 22 property: "og:url", 23 content: `${PUBLIC_URL}${ 24 galleryLink( 25 gallery.creator.handle, 26 new AtUri(gallery.uri).rkey, 27 ) 28 }`, 29 }, 30 { property: "og:title", content: gallery.title }, 31 { 32 property: "og:description", 33 content: gallery.description, 34 }, 35 { 36 property: "og:image", 37 content: `${ 38 Deno.env.get("DARKROOM_HOST_URL") || "" 39 }/xrpc/social.grain.darkroom.getGalleryComposite?uri=${ 40 encodeURIComponent(gallery.uri) 41 }&variant=collage`, 42 }, 43 ]; 44}