From 237840148f1083cc265b0d4c9dad5c5d8bfe07ce Mon Sep 17 00:00:00 2001 From: gosangam Date: Tue, 5 May 2026 10:11:30 +0530 Subject: [PATCH] fix: letter source --- components/text-selection-toolbar.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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]