diff --git a/AGENTS.md b/AGENTS.md index 7cba058..695972e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -51,10 +51,12 @@ CSS file (Gruvbox, light + dark, theme toggle without reload). - **Dates**: all visible dates (post cards, garden table) are rendered by the generator's `dateText()` helper as `Fri 2026-08-28` (English weekday + ISO date); `blog_data.date` stays ISO for sorting, `blog_data.dateText` is added for display. JSON-LD keeps ISO dates. -- **Thumbnails** (`thumbSrc()`): prefer a child note of the article titled `*_thumb.*` - (e.g. `ngc281_thumb.jpg`) → `api/notes//download`; otherwise use the first `` - from the note content. Layout: image left, summary right (`.blog-post-inner`), - `max-height:256px`, lazy-loaded. **There is no server-side resizing** – see "Limitations". +- **Thumbnails** (`thumbSrc()`): prefer a child note of the article titled `thumb.` **or** + `*_thumb.` (e.g. `thumb.png`, `ngc281_thumb.jpg`) → `api/notes//download`; otherwise + use the first `` from the note content. Layout: image left, summary right (`.blog-post-inner`), + `max-height:256px`, lazy-loaded. The generator auto-sets `shareHiddenFromTree` on matching + thumb child notes so they never appear in the blog menu. **There is no server-side resizing** – + see "Limitations". - Regenerates `feed.xml`, `sitemap.xml`, `state_map` (garden states) and `blog_data` (search index: id/title/url/summary/tags/category). Sets `shareDescription` from `summary`. diff --git a/blog_generator.js b/blog_generator.js index f2e1493..c68589a 100644 --- a/blog_generator.js +++ b/blog_generator.js @@ -103,7 +103,7 @@ function run() { function thumbSrc(a) { try { - const thumbs = (a.getChildNotes() || []).filter(n => /_thumb\.[A-Za-z0-9]+$/i.test(n.title)); + const thumbs = (a.getChildNotes() || []).filter(n => /^(?:thumb|.+_thumb)\.[A-Za-z0-9]+$/i.test(n.title)); if (thumbs.length) return "api/notes/" + thumbs[0].noteId + "/download"; } catch (e) {} try { @@ -598,6 +598,19 @@ function run() { } } + function hideThumbChildren() { + for (const a of articles) { + try { + for (const c of a.getChildNotes()) { + if (/^(?:thumb|.+_thumb)\.[A-Za-z0-9]+$/i.test(c.title) && !c.hasLabel("shareHiddenFromTree")) { + c.setLabel("shareHiddenFromTree", ""); + c.save(); + } + } + } catch (e) {} + } + } + buildIndex(); const systemNote = api.getNote(BLOG_SYSTEM_NOTE_ID); @@ -617,5 +630,6 @@ function run() { buildSitemap(); ensureSeoMeta(); buildBlogData(); + hideThumbChildren(); removeEmptyCategories(); } \ No newline at end of file