From 3ced32a4d0cfc018c7b9599263d2f941c32beb74 Mon Sep 17 00:00:00 2001 From: Neeldhara Misra Date: Mon, 22 Jun 2026 13:08:56 +0530 Subject: [PATCH] Add featured post flag for homepage --- CONTENT_BRIDGE.md | 4 +++ obsidian-plugin/microblog-sync/README.md | 5 ++- obsidian-plugin/microblog-sync/main.js | 34 +++++++++++++++++-- obsidian-plugin/microblog-sync/manifest.json | 2 +- .../content/art/indiamini-crosswords/index.md | 1 + sites/art/src/content/config.ts | 2 ++ sites/poetry/src/content/config.ts | 2 ++ .../src/content/poetry/poems/poetry/index.md | 1 + sites/puzzles/src/content/config.ts | 2 ++ .../puzzles/dogs-bunny-puzzle/index.md | 1 + sites/reflections/src/content/config.ts | 2 ++ .../reflections/on-career-choices/index.md | 1 + sites/research/src/content/config.ts | 2 ++ .../content/research/crypto-intro/index.md | 1 + sites/reviews/src/content/config.ts | 2 ++ .../reviews/note-taking-resources/index.md | 1 + sites/vibes/src/content/config.ts | 2 ++ .../vibes/src/content/vibes/13sheep/index.md | 1 + src/content/config.ts | 2 ++ 19 files changed, 63 insertions(+), 5 deletions(-) diff --git a/CONTENT_BRIDGE.md b/CONTENT_BRIDGE.md index b5374cd..e1979d8 100644 --- a/CONTENT_BRIDGE.md +++ b/CONTENT_BRIDGE.md @@ -71,6 +71,10 @@ Optional fields currently understood by the sites include `updatedDate`, `image`, and `authorImage`. Prefer colocated images in the body over remote stock images. +Use `main-feature: true` on at most one post per blog to pin a fixed featured +post on the `neeldhara.blog` homepage. The homepage still shows the two newest +non-featured posts for that blog, sorted by `pubDate`. + The Quarto import also preserved `sourceCategories` and `sourcePath`. Astro strips unknown schema fields, but they are useful in Obsidian for provenance. diff --git a/obsidian-plugin/microblog-sync/README.md b/obsidian-plugin/microblog-sync/README.md index 5381e49..f440a66 100644 --- a/obsidian-plugin/microblog-sync/README.md +++ b/obsidian-plugin/microblog-sync/README.md @@ -34,7 +34,10 @@ Search for **Blog Family Sync** in the command palette: Preview starts the matching Astro dev server if the configured local URL is not already responding. Publish syncs first, runs that target's build command, -commits staged content changes, and pushes to Forgejo. +commits staged content changes, and pushes to Forgejo. For the seven `allblogs` +targets, publish also refreshes and pushes the `home` repo's +`content/blog-index.json` so `neeldhara.blog` redeploys with the newest +featured/latest entries. ## Notes diff --git a/obsidian-plugin/microblog-sync/main.js b/obsidian-plugin/microblog-sync/main.js index 20b4f58..3bb17fc 100644 --- a/obsidian-plugin/microblog-sync/main.js +++ b/obsidian-plugin/microblog-sync/main.js @@ -11,6 +11,7 @@ const NPM = `${NODE_BIN}/npm`; const BLOGS_ROOT = "/Users/neeldhara/forgejo/blogs"; const ALLBLOGS_REPO = `${BLOGS_ROOT}/allblogs`; const MICRO_REPO = `${BLOGS_ROOT}/micro`; +const HOME_REPO = `${BLOGS_ROOT}/home`; const DEFAULT_TARGETS = [ { @@ -557,14 +558,41 @@ module.exports = class BlogFamilySyncPlugin extends Plugin { this.updateStatusBar(`Blog sync: pushing ${target.label}...`); const output = await this.runShellCommand(publishCommand, repoFolder); + + let homeOutput = ""; + if (path.resolve(target.repoFolder) === path.resolve(ALLBLOGS_REPO)) { + homeOutput = await this.publishHomeIndex(); + } + this.updateStatusBar("Blog sync: published"); new Notice( - output.includes("No staged changes") - ? `No ${target.label} changes to publish.` - : `${target.label} changes pushed.`, + [ + output.includes("No staged changes") + ? `No ${target.label} changes to publish.` + : `${target.label} changes pushed.`, + homeOutput + ? homeOutput.includes("No homepage index changes") + ? "Homepage index unchanged." + : "Homepage index pushed." + : "", + ] + .filter(Boolean) + .join(" "), ); } + async publishHomeIndex() { + this.updateStatusBar("Blog sync: refreshing homepage index..."); + const command = [ + `${shellQuote(NPM)} run refresh:index`, + "git add content/blog-index.json", + 'if git diff --cached --quiet; then echo "No homepage index changes to publish."; else git commit -m "Refresh homepage blog index"; fi', + "git push", + ].join(" && "); + + return await this.runShellCommand(command, HOME_REPO); + } + async ensureDevServer(target) { const baseUrl = normalizeBaseUrl(target.devServerUrl); if (await urlResponds(baseUrl)) { diff --git a/obsidian-plugin/microblog-sync/manifest.json b/obsidian-plugin/microblog-sync/manifest.json index 1abb168..d7eec84 100644 --- a/obsidian-plugin/microblog-sync/manifest.json +++ b/obsidian-plugin/microblog-sync/manifest.json @@ -1,7 +1,7 @@ { "id": "microblog-sync", "name": "Blog Family Sync", - "version": "0.4.0", + "version": "0.5.0", "minAppVersion": "1.5.0", "description": "Sync the public Obsidian blog folders with the local Astro blog repos.", "author": "Neeldhara Misra", diff --git a/sites/art/src/content/art/indiamini-crosswords/index.md b/sites/art/src/content/art/indiamini-crosswords/index.md index 420bf64..5c6c88f 100644 --- a/sites/art/src/content/art/indiamini-crosswords/index.md +++ b/sites/art/src/content/art/indiamini-crosswords/index.md @@ -3,6 +3,7 @@ title: "Creating a Gallery of Solved Crosswords" description: "H/T Manu: I've discovered the India Mini Crossword series and it's a great two-to-five minute thing to solve every morning! Here's a little workflow I cobbled together to genera..." pubDate: "2024-05-10" authorName: "Neeldhara" +main-feature: true sourceCategories: ["workflows"] sourcePath: "indiamini-crosswords/index.qmd" --- diff --git a/sites/art/src/content/config.ts b/sites/art/src/content/config.ts index 41abd05..c057f86 100644 --- a/sites/art/src/content/config.ts +++ b/sites/art/src/content/config.ts @@ -9,6 +9,8 @@ const blogSchema = z.object({ image: z.string().optional(), authorImage: z.string().optional(), authorName: z.string().optional(), + "main-feature": z.boolean().optional(), + mainFeature: z.boolean().optional(), }); const research = defineCollection({ diff --git a/sites/poetry/src/content/config.ts b/sites/poetry/src/content/config.ts index 41abd05..c057f86 100644 --- a/sites/poetry/src/content/config.ts +++ b/sites/poetry/src/content/config.ts @@ -9,6 +9,8 @@ const blogSchema = z.object({ image: z.string().optional(), authorImage: z.string().optional(), authorName: z.string().optional(), + "main-feature": z.boolean().optional(), + mainFeature: z.boolean().optional(), }); const research = defineCollection({ diff --git a/sites/poetry/src/content/poetry/poems/poetry/index.md b/sites/poetry/src/content/poetry/poems/poetry/index.md index 70ed87b..1bbd151 100644 --- a/sites/poetry/src/content/poetry/poems/poetry/index.md +++ b/sites/poetry/src/content/poetry/poems/poetry/index.md @@ -3,6 +3,7 @@ title: "Poetry" description: "collect your grief and inject it in words spill them on paper and shred it to tatters to piece yourself together ---" pubDate: "2024-01-01" authorName: "Neeldhara" +main-feature: true sourceCategories: ["poem"] sourcePath: "poems/poetry/index.qmd" --- diff --git a/sites/puzzles/src/content/config.ts b/sites/puzzles/src/content/config.ts index 41abd05..c057f86 100644 --- a/sites/puzzles/src/content/config.ts +++ b/sites/puzzles/src/content/config.ts @@ -9,6 +9,8 @@ const blogSchema = z.object({ image: z.string().optional(), authorImage: z.string().optional(), authorName: z.string().optional(), + "main-feature": z.boolean().optional(), + mainFeature: z.boolean().optional(), }); const research = defineCollection({ diff --git a/sites/puzzles/src/content/puzzles/dogs-bunny-puzzle/index.md b/sites/puzzles/src/content/puzzles/dogs-bunny-puzzle/index.md index b6875f8..e6a87f4 100644 --- a/sites/puzzles/src/content/puzzles/dogs-bunny-puzzle/index.md +++ b/sites/puzzles/src/content/puzzles/dogs-bunny-puzzle/index.md @@ -3,6 +3,7 @@ title: "Dog Bunny Puzzle" description: "Dog Bunny: A Cute Puzzle Conrad Barski (@lisperati)'s latest, Dog Bunny Puzzle, had jumped to 1 on HN. The puzzle presents the following somewhat minimalist interface: If you ha..." pubDate: "2022-09-19" authorName: "Neeldhara" +main-feature: true sourceCategories: ["puzzles", "exposition"] sourcePath: "dogs-bunny-puzzle/index.qmd" --- diff --git a/sites/reflections/src/content/config.ts b/sites/reflections/src/content/config.ts index 41abd05..c057f86 100644 --- a/sites/reflections/src/content/config.ts +++ b/sites/reflections/src/content/config.ts @@ -9,6 +9,8 @@ const blogSchema = z.object({ image: z.string().optional(), authorImage: z.string().optional(), authorName: z.string().optional(), + "main-feature": z.boolean().optional(), + mainFeature: z.boolean().optional(), }); const research = defineCollection({ diff --git a/sites/reflections/src/content/reflections/on-career-choices/index.md b/sites/reflections/src/content/reflections/on-career-choices/index.md index 1de4e58..9308d28 100644 --- a/sites/reflections/src/content/reflections/on-career-choices/index.md +++ b/sites/reflections/src/content/reflections/on-career-choices/index.md @@ -3,6 +3,7 @@ title: "On Career Choices" description: "Tip A version of this article was featured in A Lesson from IIT , a column on the Indian Express. The link to the column is here, and this is the link to the present article. Ma..." pubDate: "2023-05-26" authorName: "Neeldhara" +main-feature: true sourceCategories: ["funda"] sourcePath: "on-career-choices/index.qmd" --- diff --git a/sites/research/src/content/config.ts b/sites/research/src/content/config.ts index 41abd05..c057f86 100644 --- a/sites/research/src/content/config.ts +++ b/sites/research/src/content/config.ts @@ -9,6 +9,8 @@ const blogSchema = z.object({ image: z.string().optional(), authorImage: z.string().optional(), authorName: z.string().optional(), + "main-feature": z.boolean().optional(), + mainFeature: z.boolean().optional(), }); const research = defineCollection({ diff --git a/sites/research/src/content/research/crypto-intro/index.md b/sites/research/src/content/research/crypto-intro/index.md index a7fbc26..f1c565f 100644 --- a/sites/research/src/content/research/crypto-intro/index.md +++ b/sites/research/src/content/research/crypto-intro/index.md @@ -3,6 +3,7 @@ title: "Intro to Crypto" description: "Caution Background This post is based on a series of lectures that Venkata Koppula gave at IIT Gandhiangar during the inter-IIT sports meet. Lecture 1: How to define security? N..." pubDate: "2023-12-21" authorName: "Neeldhara" +main-feature: true sourceCategories: ["talk", "exposition"] sourcePath: "crypto-intro/index.qmd" --- diff --git a/sites/reviews/src/content/config.ts b/sites/reviews/src/content/config.ts index 41abd05..c057f86 100644 --- a/sites/reviews/src/content/config.ts +++ b/sites/reviews/src/content/config.ts @@ -9,6 +9,8 @@ const blogSchema = z.object({ image: z.string().optional(), authorImage: z.string().optional(), authorName: z.string().optional(), + "main-feature": z.boolean().optional(), + mainFeature: z.boolean().optional(), }); const research = defineCollection({ diff --git a/sites/reviews/src/content/reviews/note-taking-resources/index.md b/sites/reviews/src/content/reviews/note-taking-resources/index.md index 9ab6383..aca5a58 100644 --- a/sites/reviews/src/content/reviews/note-taking-resources/index.md +++ b/sites/reviews/src/content/reviews/note-taking-resources/index.md @@ -3,6 +3,7 @@ title: "Note Taking Resources" description: "Here is a list of courses, books, essays, youtube playlists, and other miscellany about taking notes, with the act interpreted broadly to include things like systems for filing,..." pubDate: "2023-06-02" authorName: "Neeldhara" +main-feature: true sourceCategories: ["lists"] sourcePath: "note-taking-resources/index.qmd" --- diff --git a/sites/vibes/src/content/config.ts b/sites/vibes/src/content/config.ts index 41abd05..c057f86 100644 --- a/sites/vibes/src/content/config.ts +++ b/sites/vibes/src/content/config.ts @@ -9,6 +9,8 @@ const blogSchema = z.object({ image: z.string().optional(), authorImage: z.string().optional(), authorName: z.string().optional(), + "main-feature": z.boolean().optional(), + mainFeature: z.boolean().optional(), }); const research = defineCollection({ diff --git a/sites/vibes/src/content/vibes/13sheep/index.md b/sites/vibes/src/content/vibes/13sheep/index.md index e6a12f5..1df8548 100644 --- a/sites/vibes/src/content/vibes/13sheep/index.md +++ b/sites/vibes/src/content/vibes/13sheep/index.md @@ -3,6 +3,7 @@ title: "13 Sheep" description: "13 Sheep happens to be a cute roll-and-write game designed by Moritz Dressler that involves protecting a bunch of sheep on a grid by placing small fences that have pre-defined s..." pubDate: "2023-03-26" authorName: "Neeldhara" +main-feature: true sourceCategories: ["games", "exposition"] sourcePath: "13sheep/index.qmd" --- diff --git a/src/content/config.ts b/src/content/config.ts index 41abd05..c057f86 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -9,6 +9,8 @@ const blogSchema = z.object({ image: z.string().optional(), authorImage: z.string().optional(), authorName: z.string().optional(), + "main-feature": z.boolean().optional(), + mainFeature: z.boolean().optional(), }); const research = defineCollection({