diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..433b482 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.min.css diff --git a/templates/share/page.ejs b/templates/share/page.ejs index 2818912..594184b 100644 --- a/templates/share/page.ejs +++ b/templates/share/page.ejs @@ -34,7 +34,15 @@ if (subRoot.note.hasRelation("shareOpenGraphImage")) { ogImageRel = `api/images/${subRoot.note.getRelation("shareOpenGraphImage").value}/image.png`; } - const ogImage = ogImageRel ? rootUrl + ogImageRel : ""; + // Per-article OG image: a thumbnail child note beats the site-wide fallback. + if (note.getLabelValue("publish") === "true") { + try { + const thumbs = (note.getChildNotes() || []) + .filter(n => /^(?:thumb|.+_thumb)\.[A-Za-z0-9]+$/i.test(n.title)); + if (thumbs.length) ogImageRel = `api/notes/${thumbs[0].noteId}/download`; + } catch (e) {} + } + const ogImage = ogImageRel ? (ogImageRel.startsWith("http") ? ogImageRel : rootUrl + ogImageRel) : ""; const jsonLd = []; if (note.noteId === subRoot.note.noteId) { @@ -71,8 +79,9 @@