From c934fd38913db98f815ae0a9520e1d27d2393e7a Mon Sep 17 00:00:00 2001 From: Brittany Ellich Date: Wed, 22 Apr 2026 18:16:14 -0700 Subject: [PATCH] Update shared content for leaflet --- src/lib/shared-content.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/lib/shared-content.ts b/src/lib/shared-content.ts index 38e30c6..f57ce79 100644 --- a/src/lib/shared-content.ts +++ b/src/lib/shared-content.ts @@ -201,11 +201,16 @@ export async function fetchSharedContent( // Build the URL for the post let href = ''; if (doc.path && doc.site) { - // Try to resolve the publication URL - const pubDoc = await fetchRecord(doc.site); - const baseUrl = (pubDoc as unknown as { url?: string })?.url; - if (baseUrl) { - href = `${baseUrl.replace(/\/$/, '')}${doc.path}`; + if (doc.site.startsWith('https://') || doc.site.startsWith('http://')) { + // site is already a URL — use it directly as the base + href = `${doc.site.replace(/\/$/, '')}${doc.path}`; + } else { + // site is an AT-URI — try to resolve the publication URL + const pubDoc = await fetchRecord(doc.site); + const baseUrl = (pubDoc as unknown as { url?: string })?.url; + if (baseUrl) { + href = `${baseUrl.replace(/\/$/, '')}${doc.path}`; + } } } if (!href && doc.path) { -- 2.51.2