fix: og image for glossary

This commit is contained in:
gosangam
2026-05-06 15:52:44 +05:30
parent e5fb370997
commit cbd9c55777
3 changed files with 90 additions and 8 deletions
+20 -1
View File
@@ -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 };
}