diff --git a/components/text-selection-toolbar.tsx b/components/text-selection-toolbar.tsx index eb1f71d2..657eddef 100644 --- a/components/text-selection-toolbar.tsx +++ b/components/text-selection-toolbar.tsx @@ -202,10 +202,17 @@ function getSourceReference(): { parts[1] !== "recipient" && parts[1] !== "location" ) { - // Try to get the title from the h1 + // h1 contains "Letter to Mukunda" — use it as the title const h1 = document.querySelector("h1"); const title = h1?.textContent?.trim() || "Letter"; - return { title: "Letters of Śrīla Prabhupāda", detail: title, url }; + + // The
sibling after h1 contains "15 January, 1968 · Calcutta" + const metaP = document.querySelector( + "header p.text-muted-foreground, header p[class*='muted']", + ); + const meta = metaP?.textContent?.trim() || null; + + return { title, detail: meta, url }; } // /essays/[slug]