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