Skip to content

q-uint/weblog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors