a tool for shared writing and social publishing

add some metadata to pubs

+38
+19
app/lish/[handle]/[publication]/[rkey]/page.tsx
··· 11 11 PubLeafletDocument, 12 12 PubLeafletPagesLinearDocument, 13 13 } from "lexicons/src"; 14 + import { Metadata } from "next"; 14 15 15 16 const idResolver = new IdResolver(); 17 + export async function generateMetadata(props: { 18 + params: { publication: string; handle: string; rkey: string }; 19 + }): Promise<Metadata> { 20 + let did = await idResolver.handle.resolve(props.params.handle); 21 + if (!did) return { title: "Publication 404" }; 22 + 23 + let { data: document } = await supabaseServerClient 24 + .from("documents") 25 + .select("*") 26 + .eq("uri", AtUri.make(did, ids.PubLeafletDocument, props.params.rkey)) 27 + .single(); 28 + 29 + if (!document) return { title: "404" }; 30 + let record = document.data as PubLeafletDocument.Record; 31 + return { 32 + title: record.title + " - " + decodeURIComponent(props.params.publication), 33 + }; 34 + } 16 35 export default async function Post(props: { 17 36 params: { publication: string; handle: string; rkey: string }; 18 37 }) {
+19
app/lish/[handle]/[publication]/page.tsx
··· 9 9 PubLeafletPublication, 10 10 } from "lexicons/src"; 11 11 import { CallToActionButton } from "./CallToActionButton"; 12 + import { Metadata } from "next"; 12 13 13 14 const idResolver = new IdResolver(); 15 + 16 + export async function generateMetadata(props: { 17 + params: { publication: string; handle: string }; 18 + }): Promise<Metadata> { 19 + let did = await idResolver.handle.resolve(props.params.handle); 20 + if (!did) return { title: "Publication 404" }; 21 + 22 + let { data: publication } = await supabaseServerClient 23 + .from("publications") 24 + .select( 25 + "*, documents_in_publications(documents(*)), leaflets_in_publications(*, permission_tokens(*, permission_token_rights(*), custom_domain_routes!custom_domain_routes_edit_permission_token_fkey(*) ))", 26 + ) 27 + .eq("identity_did", did) 28 + .eq("name", decodeURIComponent(props.params.publication)) 29 + .single(); 30 + if (!publication) return { title: "404 Publication" }; 31 + return { title: decodeURIComponent(props.params.publication) }; 32 + } 14 33 15 34 export default async function Publication(props: { 16 35 params: { publication: string; handle: string };