fix: og image for glossary
This commit is contained in:
+20
-1
@@ -164,8 +164,27 @@ export function getSourceReference(): {
|
||||
return { title: parentTitle, detail: chapterTitle, url };
|
||||
}
|
||||
|
||||
// /glossary — general
|
||||
// /glossary/[letter]?term=...
|
||||
if (parts[0] === "glossary") {
|
||||
const h1 = document.querySelector("h1");
|
||||
const termFromH1 = h1?.textContent?.replace(/^Glossary:\s*/, "").trim();
|
||||
|
||||
// Try to get the term from the URL ?term= param
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const termFromUrl = urlParams.get("term");
|
||||
|
||||
const term = termFromUrl || termFromH1 || null;
|
||||
|
||||
if (term) {
|
||||
return { title: term, detail: "Glossary — Prabhupāda Says", url };
|
||||
}
|
||||
|
||||
// Fallback: letter-level
|
||||
const letter = parts[1]?.toUpperCase();
|
||||
if (letter) {
|
||||
return { title: `Glossary — ${letter}`, detail: null, url };
|
||||
}
|
||||
|
||||
return { title: "Glossary", detail: null, url };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user