diff --git a/app/lish/[did]/[publication]/[rkey]/getPostPageData.ts b/app/lish/[did]/[publication]/[rkey]/getPostPageData.ts index 7f26cd9f..395b5348 100644 --- a/app/lish/[did]/[publication]/[rkey]/getPostPageData.ts +++ b/app/lish/[did]/[publication]/[rkey]/getPostPageData.ts @@ -23,8 +23,10 @@ export async function getPostPageData(uri: string) { // Fetch constellation backlinks for mentions const pubRecord = document.documents_in_publications[0]?.publications ?.record as PubLeafletPublication.Record; - const rkey = new AtUri(uri).rkey; - const postUrl = `https://${pubRecord?.base_path}/${rkey}`; + let aturi = new AtUri(uri); + const postUrl = pubRecord + ? `https://${pubRecord?.base_path}/${aturi.rkey}` + : `https://leaflet.pub/p/${aturi.host}/${aturi.rkey}`; const constellationBacklinks = await getConstellationBacklinks(postUrl); // Deduplicate constellation backlinks (same post could appear in both links and embeds)