diff --git a/scripts/build.mjs b/scripts/build.mjs index 89e893a..e932976 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -1,16 +1,45 @@ import { mkdir, writeFile } from "node:fs/promises"; const blogs = [ - ["research", "research"], - ["vibes", "vibes"], - ["puzzles", "puzzles"], - ["reflections", "reflections"], - ["poetry", "poetry"], - ["reviews", "reviews"], - ["art", "art"], + { + slug: "research", + label: "Research", + summary: "Notes from papers, algorithms, computational social choice, and mini-surveys of themes I am learning about.", + }, + { + slug: "vibes", + label: "Vibes", + summary: "Loose experiments, AI conversations, and work-in-progress thoughts that do not need a formal frame.", + }, + { + slug: "puzzles", + label: "Puzzles", + summary: "Problems, teaching prompts, contest-style curiosities, and small mathematical rabbit holes.", + }, + { + slug: "reflections", + label: "Reflections", + summary: "Personal notes on teaching, academia, writing, attention, and the rhythms of intellectual work.", + }, + { + slug: "poetry", + label: "Poetry", + summary: "Poems, tiny forms, and playful writing around mathematics, code, and ordinary life.", + }, + { + slug: "reviews", + label: "Reviews", + summary: "Notes on tools, workflows, books, hardware, and objects that shape everyday work.", + }, + { + slug: "art", + label: "Art", + summary: "Algorithmic sketches, generative art, visual experiments, and mathematical images.", + }, ]; const rssHostSuffix = process.env.RSS_HOST_SUFFIX ?? "neeldhara.email"; +const publicHostSuffix = process.env.PUBLIC_HOST_SUFFIX ?? "neeldhara.blog"; const outDir = new URL("../dist/", import.meta.url); function decodeXml(value) { @@ -60,20 +89,41 @@ async function getPosts(slug) { } function renderPost(post) { - const date = post.date ? `${escapeHtml(post.date)} ` : ""; - return `
  • ${date}${escapeHtml(post.title)}
  • `; + const date = post.date ? new Date(`${post.date}T00:00:00Z`) : null; + const dateLabel = date + ? date.toLocaleDateString("en", { month: "short", day: "numeric", timeZone: "UTC" }) + : ""; + + return `
  • ${escapeHtml(dateLabel)}${escapeHtml(post.title)}
  • `; } -function renderBlog([slug, label], posts) { - return `
  • ${escapeHtml(label)} +function renderRssIcon(blog) { + const href = `https://${blog.slug}.${publicHostSuffix}/rss.xml`; + + return ` + + `; +} + +function renderBlog(blog, posts) { + return `
    + + ${escapeHtml(blog.label)} + ${renderRssIcon(blog)} + +

    ${escapeHtml(blog.summary)}

    -
  • `; + `; } const entries = await Promise.all( - blogs.map(async (blog) => [blog, await getPosts(blog[0])]), + blogs.map(async (blog) => [blog, await getPosts(blog.slug)]), ); const html = ` @@ -84,42 +134,200 @@ const html = ` neeldhara.blog
    -

    neeldhara.blog

    - +
    + +
    +

    Neeldhara Misra

    +

    seven small blogs

    +
    +

    A quiet index of notes on research, puzzles, writing, tools, art, and other recurring fascinations.

    +
    + ${entries.map(([blog, posts]) => renderBlog(blog, posts)).join("\n ")} +
    +
    +