RazerGhost / Devlog

September 19, 2026 · 3 min read

ankerd.nl: an Astro site that rebuilds every morning

Share

ankerd is Gavin's convention channel: videos, a blog, and photos. Ankerd is my own group, so this is a side project rather than client work. I built the site in July and went back to it this week for a round of cleanup. The code is open at Gavin132/ankerd-org. Here are the parts that were more interesting than "it's an Astro site".

From blog starter to three-section hub

It started as create astro's blog template, and within a day most of it was gone. The top header became a sticky sidebar with the wordmark, nav links with an active indicator, the theme toggle and socials. On phones it became a bottom nav bar, because four sections don't need a hamburger. The theme runs on CSS custom properties under [data-theme], set by an inline script that reads localStorage and falls back to prefers-color-scheme before first paint, so there's no flash.

The content lives in three places:

  • /blog: MDX in a content collection, plus an RSS feed.
  • /gallery: one entry per photo, using the collection's image() helper and optional camera / lens / settings fields. Photos open in a native <dialog> lightbox, so there's no lightbox library.
  • /videos: fetched from the YouTube Data API at build time.

YouTube at build time, for two quota units

The obvious call is search.list, which costs 100 quota units. The cheap one is to take the channel's uploads playlist (UC… → UU…) and call playlistItems.list, which gets the same recent uploads for a fraction of that. src/lib/youtube.ts wraps it and handles every failure as a non-event: no key, no channel ID, or a non-200 response all return an empty list. The page then renders a "coming soon" state, and the build never fails because of Google.

A build-time fetch only goes stale if nobody rebuilds, so the GitHub Pages workflow has a schedule next to its push trigger:

schedule:
  # Rebuild daily so the /videos page picks up new YouTube uploads.
  - cron: '0 5 * * *'

That's the whole sync layer for videos: no webhook, no server, and no database.

Keystatic, and the one gotcha

Gavin shouldn't have to write frontmatter by hand, so blog and gallery are edited through Keystatic, which commits to the repo. Keystatic is only included outside the Pages build (isGitHubPages ? [] : [keystatic()]), since the static output doesn't need its admin routes.

The gotcha: gallery entries are .md files, and a plain fields.mdx() expects .mdx. Keystatic then sees the collection as empty and says nothing about why. The fix is one option, fields.mdx({ extension: 'md' }). The blog files were renamed to .mdx instead.

Matching the con app

The group also has an event app, Ankerd Con (devlog). When the app switched to sky blue, the site followed. The brand gradient went from cyan→teal to a four-stop sky-blue fade, and the wordmark and hero heading now share it. This week I also restyled the site's Callout to match the app's notice boxes, so the two read as one brand.

This week's cleanup

  • Fixed two loading attributes that the Astro audit flagged: an above-the-fold image set to lazy, and a below-the-fold one set to eager.
  • Fixed the mobile footer and the gallery toggle overlapping on small screens.
  • Removed @astrojs/cloudflare, which had been left over from an earlier hosting plan.
  • Blanked the YouTube key in .env.example, and rotated the key.