diff --git a/AGENTS.md b/AGENTS.md index caf0023..f5e8483 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -26,7 +26,7 @@ CSS file (Gruvbox, light + dark, theme toggle without reload). | `scripts/*.js` | one code note each (`.blog`), attached via `~shareHtml` | frontend snippets (verbatim content incl. ``; + if (dataNote.getContent() !== html) { + dataNote.setContent(html); + dataNote.save(); + api.log("blog_generator: geo_data updated (" + maps.length + " maps)"); + } + } + function buildTags() { const tagsNote = blogRoot.getChildNotes().find(n => n.title === TAGS_SECTION_TITLE); if (!tagsNote) return; @@ -634,6 +801,50 @@ function run() { } } + // Opt-in (label "blogArticleList"): append a generated list of the note's + // published child notes after the user's own content. Idempotent via marker; + // placing the marker yourself controls where the list appears. The label + // value (if any, not "true") becomes the list heading. + function buildChildArticleLists() { + const marker = ""; + const seen = new Set(); + (function walk(note, depth) { + if (depth > 20) return; + for (const child of note.getChildNotes()) { + if (seen.has(child.noteId)) continue; + seen.add(child.noteId); + if (child.hasLabel("blogArticleList")) { + const kids = child.getChildNotes().filter(c => c.getLabelValue("publish") === "true"); + kids.sort((a, b) => { + const da = a.getLabelValue("date") || a.dateCreated; + const db = b.getLabelValue("date") || b.dateCreated; + return (db < da) ? -1 : (db > da ? 1 : 0); + }); + const current = child.getContent() || ""; + const idx = current.indexOf(marker); + const userText = idx >= 0 ? current.slice(0, idx) : current; + let out; + if (kids.length) { + out = userText; + if (out && !out.endsWith("\n")) out += "\n"; + out += marker + "\n"; + const heading = child.getLabelValue("blogArticleList") || ""; + if (heading && heading !== "true") out += `