1
0
Fork
You've already forked weblog
0
A personal weblog? https://weblog.0x51.dev
  • Zig 55.5%
  • CSS 31.9%
  • Nix 11.3%
  • Shell 1.3%
2026年07月04日 00:23:16 +02:00
assets feat: add first AMDGCN post 2026年07月04日 00:23:16 +02:00
content feat: add first AMDGCN post 2026年07月04日 00:23:16 +02:00
layouts feat: add first AMDGCN post 2026年07月04日 00:23:16 +02:00
.gitignore feat: fonts, OG images, content cache, taxonomies, SEO, deploy 2026年06月08日 19:10:24 +02:00
build.zig feat: add first AMDGCN post 2026年07月04日 00:23:16 +02:00
build.zig.zon feat: add first AMDGCN post 2026年07月04日 00:23:16 +02:00
deploy.sh feat: fonts, OG images, content cache, taxonomies, SEO, deploy 2026年06月08日 19:10:24 +02:00
flake.lock feat: add first AMDGCN post 2026年07月04日 00:23:16 +02:00
flake.nix feat: add first AMDGCN post 2026年07月04日 00:23:16 +02:00
README.md feat: fonts, OG images, content cache, taxonomies, SEO, deploy 2026年06月08日 19:10:24 +02:00
zine.ziggy feat: add first AMDGCN post 2026年07月04日 00:23:16 +02:00

weblog.0x51.dev

Built with Zine. All commands assume the Nix dev shell:

nix develop # enter shell (provides zig, zine, librsvg)

... or prefix each command with nix develop --command.

Build commands

Command What it does When to run
zig build Build the site into zig-out/ Every change
zig build serve Start the Zine dev server with hot reload Local development
zig build og Render assets/og.png from assets/og.svg When the site OG card changes
zig build favicon Render assets/apple-touch-icon.png from the SVG When the favicon changes
zig build og-posts Render content/blog/<slug>/og.png for each post title Standalone re-render; otherwise automatic

zig build wipes zig-out/ before invoking Zine (Zine refuses to write to a non-empty output dir). No manual cleanup needed.

zig build and zig build serve depend on og-posts, so each post's og.png is rendered before Zine runs. Adding a post no longer needs a separate og-posts invocation.

Code snippets from pinned source

Posts can pull line-ranged snippets from external repositories without copying the code into the post. Each content/blog/<slug>/code-deps.json declares the upstream commit and the files the post references:

{
 "source": "github:q-uint/zine@eac08713d063586c161fca211533fea77c074b22",
 "files": ["src/root.zig", "src/context/utils.zig"]
}

Supported forges: github, codeberg, gitlab. The build fetches each file once via curl and caches it under .snippet-cache/<commit>/<path>.

In the post's .smd, reference a snippet by basename and line range:

[]($code.buildAsset('<slug>/utils.zig').language('zig').lines(38,68))

build.zig's rewriteSmd rewrites that directive into a hyperlink pointing at the pinned source range on the forge (e.g. https://github.com/q-uint/zine/blob/<commit>/src/context/utils.zig#L38-L68). Zine still resolves the underlying $code.buildAsset call against the cached file to embed the snippet itself.

Asset pipeline

  • assets/og.svgassets/og.png — the site-wide social card
  • assets/favicon.svgassets/apple-touch-icon.png — favicon raster fallback
  • assets/og/post-template.svg + each post's .titlecontent/blog/<slug>/og.png

The OG card and per-post cards use Space Grotesk Bold. librsvg's renderer goes through Pango, so the build steps set PANGOCAIRO_BACKEND=fc and FONTCONFIG_FILE=assets/og/fonts.conf to point at the local TTFs in assets/og/. The web pages themselves use self-hosted WOFF2 in assets/fonts/ referenced from assets/style.css.

Layout

assets/ # site-wide assets (CSS, fonts, OG/favicon sources)
content/ # markdown posts and section indexes
 blog/<slug>/
 index.smd # post frontmatter + body
 code-deps.json # external code references for this post
 og.png # generated by `zig build og-posts`
layouts/ # Zine SHTML templates
build.zig # content cache + asset render steps
zine.ziggy # Zine site config

Generated PNGs (site OG, favicon raster, per-post OG) are committed so a normal zig build works without librsvg. Re-run the relevant step after editing the SVG sources or post titles.