HAL: Build-Time Link Rewriting That Makes Navigation Feel Instant

Created: • Updated: • 3 min read
Build-time link rewriting for instant SPA-style navigation

Users judge a site in the first click. If navigating between pages feels sluggish, bounce rates climb and perceived quality drops - regardless of how good the content actually is. HTMX Auto-Linking (HAL) is the pattern I use to solve that problem at build time, with zero runtime cost.

The business problem

Every content site faces the same tradeoff: static HTML is cheap to host and great for SEO, but full-page navigations feel slow compared to a single-page app. The obvious fix - adding a client-side router - introduces a framework runtime, a bundle budget, and ongoing maintenance complexity. For a small team shipping a content product, that's a bad trade.

HAL sidesteps it entirely. During the build, it rewrites internal Markdown links into HTMX fragment swaps:

Authors write normal Markdown. The build handles the rest. External links stay untouched, and you can opt out of any individual link with data-no-htmx or class no-htmx.

Why not a SPA router?

It comes down to cost, not ideology.

Concern SPA Router HAL
JS payload 20-40KB+ gzipped (router alone), often 100-300KB with framework runtime 0KB additional - HTMX (~14KB) is already in the stack
Build complexity Code-splitting, hydration, route config One build-time string transform
Failure mode White screen if JS fails Full HTML page loads normally
Team onboarding Learn the framework's routing conventions Write Markdown links
Hosting cost Often needs SSR or edge functions Static files on any CDN

For a team of one or two shipping a content-driven product, the SPA router column is a list of costs with no corresponding revenue. HAL gives you the UX benefit - instant-feeling navigation - without the engineering overhead.

How it fits the architecture

HAL is one layer in a stack designed to stay small and cheap. The static site generation playbook covers the full build pipeline, and the architecture overview explains how Web Components and HTMX fragments work together. If you're curious about measured performance gains, the HAL performance case study has real numbers.

Example links

When to opt out

Not every link should be a fragment swap:

The takeaway

HAL is a build-time trick, not a runtime dependency. It makes navigation feel fast for the reader, costs nothing to maintain, and keeps the hosting bill at near-zero static rates. That's the kind of engineering decision that compounds - you get the UX win today and you don't pay for it tomorrow.

Recommended

Fixing Navigation and Analytics: When Your Data Lies About User Behavior htmx analytics ux architecture behind-the-scenes
Web Components + HTMX: A Lean Architecture for Content Sites That Ship architecture web-components htmx performance
HAL: Cutting 100-300KB of JavaScript by Moving Routing to Build Time performance jamstack htmx
The Static Site Playbook: Shipping a Content Product on a Near-Zero Budget jamstack architecture static-site-generation performance
How This Site Works: Architecture for a One-Person Team web development architecture performance JAMstack
Less JavaScript, More Leverage: Why I Ship With a 35KB Budget web development performance architecture
Why I Skipped the CMS architecture content tools
Documentation That Scales: Constitution, Contracts, and Runbooks documentation architecture automation process behind-the-scenes
Mobile-First Layout That Ships: How PrimaryLayout Solves Real UX Problems ux css layout htmx
Progressive Enhancement with HTMX: Ship Fast, Degrade Gracefully web development htmx progressive enhancement
Static Site Generation: The Business Case for Pre-Rendered HTML web development JAMstack performance SEO
Anthropic Trained Its Replacement ai startups founders
Pydantic: The Open Source Layer Quietly Running the AI Economy ai open-source python pydantic anthropic tools
Karpathy Was Wrong: OpenClaw Still Outruns Its 5 Real Alternatives openclaw ai tools security
OpenClaw 2026.2.23: The Agent Browser Upgrade openclaw ai automation tools
The YC S26 Deadline Just Closed. Here's What Separates the 1.5% From Everyone Else. startups yc founders
OpenClaw: What It Is and How to Get the Most Out of It ai automation ops tools
Zero-Server Analytics: How I Replaced a SaaS Bill with Netlify Functions and GitHub analytics serverless netlify github
Why I Built My Own Analytics Pipeline (And What It Actually Costs) analytics automation behind-the-scenes
Web Components as a Business Decision web development web components javascript

Recommended

Fixing Navigation and Analytics: When Your Data Lies About User Behavior htmx analytics ux architecture behind-the-scenes
Web Components + HTMX: A Lean Architecture for Content Sites That Ship architecture web-components htmx performance
HAL: Cutting 100-300KB of JavaScript by Moving Routing to Build Time performance jamstack htmx
The Static Site Playbook: Shipping a Content Product on a Near-Zero Budget jamstack architecture static-site-generation performance
How This Site Works: Architecture for a One-Person Team web development architecture performance JAMstack
Less JavaScript, More Leverage: Why I Ship With a 35KB Budget web development performance architecture
Why I Skipped the CMS architecture content tools
Documentation That Scales: Constitution, Contracts, and Runbooks documentation architecture automation process behind-the-scenes
Mobile-First Layout That Ships: How PrimaryLayout Solves Real UX Problems ux css layout htmx
Progressive Enhancement with HTMX: Ship Fast, Degrade Gracefully web development htmx progressive enhancement
Static Site Generation: The Business Case for Pre-Rendered HTML web development JAMstack performance SEO
Anthropic Trained Its Replacement ai startups founders
Pydantic: The Open Source Layer Quietly Running the AI Economy ai open-source python pydantic anthropic tools
Karpathy Was Wrong: OpenClaw Still Outruns Its 5 Real Alternatives openclaw ai tools security
OpenClaw 2026.2.23: The Agent Browser Upgrade openclaw ai automation tools
The YC S26 Deadline Just Closed. Here's What Separates the 1.5% From Everyone Else. startups yc founders
OpenClaw: What It Is and How to Get the Most Out of It ai automation ops tools
Zero-Server Analytics: How I Replaced a SaaS Bill with Netlify Functions and GitHub analytics serverless netlify github
Why I Built My Own Analytics Pipeline (And What It Actually Costs) analytics automation behind-the-scenes
Web Components as a Business Decision web development web components javascript