fix: letter source
This commit is contained in:
@@ -202,10 +202,17 @@ function getSourceReference(): {
|
|||||||
parts[1] !== "recipient" &&
|
parts[1] !== "recipient" &&
|
||||||
parts[1] !== "location"
|
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 h1 = document.querySelector("h1");
|
||||||
const title = h1?.textContent?.trim() || "Letter";
|
const title = h1?.textContent?.trim() || "Letter";
|
||||||
return { title: "Letters of Śrīla Prabhupāda", detail: title, url };
|
|
||||||
|
// The <p> 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]
|
// /essays/[slug]
|
||||||
|
|||||||
Reference in New Issue
Block a user