feat: add structured data schemas, og tags, share button, and configurable site url

This commit is contained in:
2026-05-23 01:21:55 +00:00
parent 8eea7cc0c9
commit 77ad93a4bb
35 changed files with 437 additions and 62 deletions
+19
View File
@@ -1,6 +1,7 @@
export class DomUtils {
constructor() {
this.initClipboardCopy();
this.initShareButtons();
this.initTogglers();
this.initStopPropagation();
this.initCardLinks();
@@ -23,6 +24,24 @@ export class DomUtils {
});
}
initShareButtons() {
document.querySelectorAll("[data-share]").forEach((btn) => {
btn.addEventListener("click", async (e) => {
e.preventDefault();
e.stopPropagation();
const url = new URL(btn.dataset.share || window.location.href, window.location.href).href;
try {
await navigator.clipboard.writeText(url);
const original = btn.textContent;
btn.textContent = "Copied!";
setTimeout(() => { btn.textContent = original; }, 1000);
} catch {
// silently fail
}
});
});
}
initTogglers() {
document.querySelectorAll("[data-toggle]").forEach((btn) => {
btn.addEventListener("click", () => {