How I Customized Astro Erudite to Build vanam.dev

Manav Mehta 1975 words · 9 min read #astro#webdev#design#build-log

A build log for vanam.dev: why I forked astro-erudite, the design system I added, the content model behind the blog, and the customizations that mattered — with code from the repository.

Tip (TL;DR)

astro-erudite gave me a clean, content-first Astro blog with almost no JavaScript. I forked it into vanam-erudite to add a flat technical bento homepage, a gallery collection, 14 HANCORE palettes, build-time backlinks, and env-gated comments and analytics. This post is the build log: the design goals, the content model, the customizations that carried their weight, and what I would change next.

The introduction post lists what changed. This one is about how it was built. The distinction matters because a feature list tells you what a project has; a build log tells you what it cost, what it replaced, and where the sharp edges are.

Why Astro Erudite

I wanted a personal site that could hold writing, project notes, photography, and a resume without turning into a JavaScript application. The requirements were modest but specific:

  • Content-first. Markdown files, typed frontmatter, and a build that fails when a post is malformed.
  • Static output. No server runtime for the public site. Deploy the build artifact anywhere.
  • Low client JavaScript. Reading and navigation should work without a framework hydration budget.
  • A real design system. Not a template I would fight, but a base I could extend.
  • No Tailwind requirement. I wanted plain CSS with custom properties, because the visual language is token-driven and the site is small enough that a utility layer would add indirection.

astro-erudite v2 fit the first four. It is minimal and opinionated: a blog, projects, an about page, and a sidebar, with Astro content collections and a restrained client-side footprint. Forking it meant inheriting a sane content pipeline and spending my time on the parts I actually cared about — the homepage, the theme system, and the content relationships.

The trade-off of a fork is maintenance. Upstream changes do not merge themselves, and every customization becomes something I own. For a personal site, that is acceptable. For a team template, it would need a more deliberate upgrade path.

The Design Goals

The visual direction came from the content: infrastructure, operations, security, and self-hosting. I wanted the site to feel like a technical document, not a marketing landing page. That produced a short list of constraints.

Flat, not glossy. One-pixel borders, small radii, no shadows, no glow, no glass. The surface should read as a panel, not a card floating above the page.

Mono for metadata. Labels, dates, kickers, counts, and navigation use IBM Plex Mono with tabular numerals. Body text uses IBM Plex Sans. The contrast is functional: mono signals “system information,” sans signals “prose.”

Palettes instead of a light/dark toggle. The site ships 14 palettes from the HANCORE-linux theme collection, applied through data-theme on the root element. There is no binary light/dark switch. Each palette carries its own background, foreground, accent, muted, and surface values.

Accessibility is a constraint, not a pass. Muted text targets WCAG AA 4.5 in every palette. prefers-reduced-motion is respected. The theme picker is keyboard-operable. The site should be readable before it is interesting.

A bento homepage with a job. The homepage is not a hero section. It is an index: identity, latest post, impact highlights, contact, writing, projects, photography, and a quiet local-time/weather tile. Each tile has one forward action.

How the Site Is Organized

The repository follows the template’s structure, with the content model doing most of the organizational work:

src/
├── components/ # Astro components (sidebar, cards, theme picker, search)
├── content/
│ ├── blog/ # Markdown posts, optionally with series subposts
│ ├── projects/ # Project entries with impact, tech, and links
│ ├── gallery/ # Photo galleries with covers and per-photo notes
│ └── authors/ # Author profiles
├── layouts/ # Page shell, grid backdrop, theme initialization
├── lib/ # Content helpers, theme registry, markdown plugins
├── pages/ # Routes (home, blog, projects, gallery, about, contact)
├── scripts/ # Small client modules (theme, search, lightbox, nav)
└── styles/ # Vanilla CSS tokens, layout, typography, components

The important decision is that content and presentation are separate collections, not one generic “page” type. A blog post has authors, tags, a date, and optional series order. A project has impact lines, a tech list, and an optional outbound link. A gallery has a cover image and an array of photos with optional captions. The schema enforces those differences at build time.

Customization 1: A Theme Registry as the Single Source of Truth

The theme system is the customization with the widest reach. The goal was to make one constant control the default palette, the server-rendered picker, the client-side validation, the CSS fallback, and the theme-color meta tag.

The registry lives in src/lib/themes.ts:

export type ThemeMode = "light" | "dark"
export interface HancoreTheme {
id: string
label: string
mode: ThemeMode
background: string
foreground: string
accent: string
muted: string
surface: string
blurb: string
}
export const DEFAULT_THEME_ID = "turbonite"
export const HANCORE_THEMES: readonly HancoreTheme[] = [
{
id: "blackgold",
label: "BlackGold",
mode: "dark",
background: "#0d0d0d",
foreground: "#ebdbb2",
accent: "#6e6a58",
muted: "#807c6d",
surface: "#1f1a12",
blurb: "Black marble, brass inlay",
},
// ...13 more palettes
]

The interface is deliberately small. A palette is not a full design system; it is a set of colors plus a mode. Keeping it small makes the registry easy to audit against the upstream theme files and hard to accidentally fork into two competing sources of truth.

The client behavior in src/scripts/theme-toggle.ts reads the stored value, validates it with isHancoreThemeId, applies data-theme and a code-block theme, persists the choice, updates the menu’s aria-checked state, and emits a theme-change event so embeds can re-sync. The important part is the failure behavior: if storage is unavailable, the page still renders with the default; if the stored value is a legacy "light" or "dark", it falls back to Turbonite rather than applying an invalid theme.

Customization 2: A Content Model With Guardrails

The blog schema in src/content.config.ts is where the template becomes this site. It adds series ordering, tags, authors, a pinned flag, and drafts — plus a refinement that prevents a post from being both pinned and draft:

const blog = defineCollection({
loader: glob({ pattern: "**/[^_]*.md", base: "./src/content/blog" }),
schema: ({ image }) =>
z
.object({
title: z.string(),
description: z.string(),
date: z.coerce.date(),
order: z.number().optional(),
tags: z.array(z.string()).optional(),
authors: z.array(reference("authors")),
image: image().optional(),
pinned: z.boolean().optional(),
draft: z.boolean().optional(),
})
.refine((data) => !(data.pinned === true && data.draft === true), {
message: "Blog post cannot be both pinned and draft",
}),
})

That refinement is a small example of a larger principle: make invalid states fail at build time. A pinned draft would silently disappear from both the published list and the pinned section, which is exactly the kind of bug that wastes an afternoon. The schema catches it before the build.

The project and gallery schemas follow the same idea. Projects use a plain tech list rather than tags, because “technologies used” and “topics written about” are different taxonomies. Galleries store photos as objects with an optional note, so a caption can appear in the lightbox without forcing every photo to have one.

Customization 3: A Bento Homepage Built on Named Grid Areas

The homepage is a flat bento grid. The layout uses named areas so the visual order and the DOM order can be reasoned about separately:

.bento {
display: grid;
gap: var(--space-s);
grid-template-columns: minmax(0, 1fr);
grid-template-areas:
"identity"
"latest"
"impact"
"connect"
"writing"
"projects"
"photo"
"weather";
}
@media (width >= 30rem) {
.bento {
grid-template-columns: repeat(2, minmax(0, 1fr));
grid-template-areas:
"identity identity"
"latest latest"
"impact connect"
"writing projects"
"photo photo"
"weather weather";
}
}

This is intentionally unglamorous CSS. There is no layout library, no container-query framework, and no client-side resize logic. The breakpoint is one media query at 30rem, and the tile content is server-rendered. The result is a homepage that is fast because it has very little to do.

The tile styling is where the design language lives: border: 1px solid var(--border), small radius, mono labels, tabular numerals, and a single corner action per tile. The constraint that every tile carries exactly one forward link is not just aesthetic. It prevents the homepage from becoming a maze of competing calls to action.

Backlinks are usually a feature of wiki-style tools, not blogs. I wanted the “Linked from” section to appear automatically whenever one post links to another, without maintaining a separate index or adding a custom syntax.

The implementation in src/lib/content.ts scans the Markdown bodies at build time:

export async function getBacklinks(
postId: string,
): Promise<CollectionEntry<"blog">[]> {
const posts = await getCollection("blog", ({ data }) => !data.draft)
const target = `/blog/${postId}`
return posts.filter((p) => p.id !== postId && (p.body ?? "").includes(target))
}

It matches ordinary Markdown links that point at /blog/<id>, so authoring stays normal: write a link, and the backlink appears. The function excludes drafts, which means a draft can link to a published post without leaking its own existence into the published backlink graph.

The trade-off is that this is a substring match, not a parsed link graph. It will also match a URL inside a code block if that code contains the exact path. For a personal site, the simplicity is worth it. For a larger content graph, I would parse the AST and resolve links properly.

Customization 5: Search, Comments, and Analytics — Optional by Default

The base template’s best quality is that it does not force a stack on you. I kept that property:

  • Search uses Pagefind in production and a title-index fallback in development, exposed through a Cmd+K command palette and a ? shortcuts dialog.
  • Comments use Giscus, backed by GitHub Discussions. They render only when the repository, repo ID, and category ID are configured.
  • Analytics use Umami, loaded only when a website ID is present. No cookies, no tracking script when unconfigured.

The env-gating matters. A clone of the repository builds and runs without any of these services. That is the difference between a template and a hosted product.

Deployment and Maintenance

The build is a static artifact. The relevant scripts from package.json are:

"scripts": {
"dev": "astro dev",
"build": "astro check && astro build",
"postbuild": "node scripts/postbuild.mjs",
"format": "biome format --write .",
"lint": "biome check .",
"check": "biome check . && astro check"
}

astro check runs before the build, so type errors in Astro components fail the deploy instead of shipping. The postbuild step indexes the generated output with Pagefind. Biome handles formatting and linting. Husky and commitlint keep commit messages conventional, which makes the history readable and gives the release tooling something predictable to work with.

Drafts have a deliberate lifecycle. They are routable so I can preview them, but they are excluded from getPosts(), the RSS feed, the tag index, and the sitemap. The sitemap exclusion is computed at config time by scanning frontmatter for draft: true, so a draft cannot accidentally become indexable by being linked from somewhere else. The post template also marks drafts noindex.

The maintenance burden is mostly content, not code. When upstream changes, I review the diff rather than merging blindly. When I add a feature, I ask whether it needs client JavaScript. Most of the time, it does not.

Closing

The fork was worth it because the base template let me spend my time on the parts that make the site mine: the flat technical visual language, the theme registry, the content model, and the small content graph. The customizations that survived are the ones that removed work or enforced a rule. The ones I would reconsider are the ones that added a feature without a clear owner.

The site is at vanam.dev and the fork is at vanam-erudite. The introduction post covers the feature list; this one is the maintenance manual.

If you are considering a fork of your own, the question I would start with is not “what features do I want?” It is “which parts of this template do I want to own?” The answer determines whether a fork is a weekend project or a long-term relationship.

Keyboard Shortcuts