Bifrost Theme
The multilingual reading theme — templates, shortcodes, SCSS architecture, and how to extend it.
On this page
Bifrost is the Zola theme that powers www.wheelofheaven.world. Named after the rainbow bridge in Norse mythology — and reused here by docs-theme, which imports Bifrost’s design tokens via SCSS so palette, typography, and spacing come from one source.
The docs site pins Bifrost as a submodule, independently of the pin in www. Nothing keeps the two pins level, so token changes reach the docs site only when someone bumps its pin — and only the four files under sass/abstracts/ matter when deciding whether to.
Previewing your changes#
Bifrost is developed through the www repo — the theme has no site of its own. Be aware that Zola has no incremental path for theme edits: a one-line SCSS change under themes/ re-renders all 10,689 pages, which is about three minutes.
Use mise run dev (English only, ~19s) or mise run css (SCSS only, ~0.5s) instead of mise run serve. See Fast Theme Loop.
Overview#
- Repository: github.com/wheelofheaven/bifrost
- License: CC0-1.0 (Public Domain)
- Zola version: 0.19.0+
- Languages: 10 supported
Features#
- Multilingual — 10 languages with RTL handling for Hebrew (
he) - Dark/light mode — system-aware with manual toggle
- Responsive — mobile-first design
- Accessible — WCAG 2.1 AA compliant
- SEO optimized — JSON-LD schemas, meta tags
- PWA ready — offline support, installable
Installation#
Add as a Git submodule:
git submodule add https://github.com/wheelofheaven/bifrost themes/bifrostUpdate config.toml:
theme = "bifrost"Directory structure#
bifrost/
├── theme.toml # theme metadata
├── templates/
│ ├── base.html # root template
│ ├── index.html # homepage
│ ├── 404.html
│ ├── *-section.html # section templates
│ ├── *-page.html # page templates
│ ├── macros/ # reusable macros
│ ├── partials/
│ │ ├── schema/ # JSON-LD schemas
│ │ └── icons/ # SVG icons
│ └── shortcodes/ # markdown shortcodes
├── sass/ # SCSS (7-1 architecture)
│ ├── main.scss # entry point
│ ├── abstracts/ # variables, mixins
│ ├── base/ # reset, typography
│ ├── components/ # UI components
│ ├── layout/ # navbar, footer
│ ├── pages/ # page-specific
│ ├── themes/ # light/dark
│ └── vendors/ # third-party
└── static/
└── js/ # JavaScript modulesTemplates#
Section templates#
| Template | Section |
|---|---|
wiki-section.html | Wiki index |
timeline-section.html | Timeline / ages index |
library-section.html | Book library index |
articles-section.html | Articles index |
news-section.html | Newsroom dispatches index |
sources-section.html | JSON-driven bibliography page |
Page templates#
| Template | Content type |
|---|---|
wiki-page.html | Wiki entries |
timeline-page.html | Precessional ages |
library-book.html | Book reader |
articles-page.html | Long-form essays |
news-page.html | Newsroom dispatches |
info-page.html | Standalone pages (about, press, contact) |
Shortcodes#
| Shortcode | Usage |
|---|---|
figure | Responsive images with CDN |
cite | Citation references |
definition | Term definitions |
info | Info boxes |
link | Internal links |
ref | Cross-references |
reference | Bibliography entries |
author | Author attribution |
library | Library links |
Figure shortcode#
{{ figure(src="wiki/elohim", caption="The Elohim") }}Generates a responsive <picture> with AVIF/WebP/JPG sources from the assets CDN.
JavaScript modules#
| Module | Purpose |
|---|---|
navbar.js | Navigation behavior |
search.js | Client-side search |
library-reader.js | Book reading UI |
library-storage.js | Persistence layer |
library-study-tools.js | Bookmarks, highlights |
library-search.js | In-book search |
pwa.js | Service worker |
toc-scroll-spy.js | ToC highlighting |
to-top.js | Scroll to top |
timeline.js | Timeline interactions |
reading-list.js | Reading list feature |
Links: every page link passes trailing_slash=true#
Zola’s get_url drops the trailing slash from a page path even when the literal has one: get_url(path="wiki/", lang=detected_lang) renders …/wiki. Cloudflare Pages answers that with a 308 to …/wiki/, so every link in the navbar, footer, breadcrumbs, see-also cards and the wiki shortcode cost a redirect per click — and per crawl. In one week of October 2026, 6,240 of the 35k requests from AI crawlers were exactly those redirects. Since bifrost 78278f7 all 174 page-link call sites pass the flag:
{{ get_url(path="wiki/", lang=detected_lang, trailing_slash=true) }}
{{ get_url(path="sources/" ~ source.id, lang=detected_lang, trailing_slash=true) }}
{{ get_url(path="", lang=detected_lang, trailing_slash=true) }} {# home #}Two traps inside the trap: a path that starts with / combined with lang renders a double slash (/zh//articles), so page paths never start with /; and the home link uses path="", because "/" plus the flag renders /de//. File paths — site.webmanifest, feeds, images, and the bundles loaded with cachebust=true — do not take the flag.
Verify any template change against a build before pushing. This must print nothing (the lean dev build keeps the production base URL):
grep -rhoE 'href="https://www\.wheelofheaven\.world/[^"#?]*"' public-dev --include='*.html' \
| grep -vE '/"$' | grep -vE '\.[a-z0-9]{2,11}"$' | sort | uniq -cLinks to other content: fall back to English#
get_url(path, lang) always builds the translated address, whether or not that translation exists. A German page linking to an entry nobody has translated yet sent readers to /de/wiki/graham-hancock/ — a 404. Any link whose target comes from content data (see-also, canon_links, references, “cited by” lists, library cards, map nodes, the wiki / libref / library / scripture shortcodes) goes through the i18n_url macro instead:
{% import "macros/i18n-url.html" as i18n_url %}
<a href="{{ i18n_url::content(path=item_path, lang=detected_lang) | safe }}">…</a>
{% set href = i18n_url::content(path="library/" ~ book ~ anchor, lang=detected_lang) %}It links the translated page when content/<lang>/<path>.md (or _index.md / index.md) exists, the English page when only the English file exists, and keeps the translated address when neither file matches by name (a page whose slug differs from its file name, such as council-of-eternals.md). Tera has no page-exists test, so the macro uses load_data(required=false), which Zola caches per path. The path may carry a leading/trailing slash and a #anchor; pass the anchor inside path, because a macro call cannot be concatenated with ~.
Navigation links to sections that exist in every language (home, wiki/, articles/, breadcrumbs) keep plain get_url.
Two things the macro cannot see: aliases (a {% wiki(slug=…) %} pointing at an alias such as planet-of-the-eternals still 404s in other languages — link the canonical slug) and source ids with no generated stub page.
JavaScript bundling & cache-busting#
The site does not serve the raw static/js/*.js sources — it serves committed esbuild bundles under static/js/dist/*.bundle.js. Editing a source module is not enough on its own: regenerate and commit the bundle.
When you change any static/js/*.js:
- Edit the source module.
mise run bundle(orcd themes/bifrost && npm run bundle) — runsscripts/bundle.js(esbuild) and rewritesstatic/js/dist/*.bundle.js.- Commit the regenerated
dist/*.bundle.jsartifact alongside the source.mise run buildalso bundles first, but a plainzola buildserves the committed bundle — so it must be up to date in git.
Entry points are declared in themes/bifrost/scripts/bundle.js:
| Bundle | Loaded | Contains |
|---|---|---|
core.bundle.js | every page, ?h=<contenthash> | navbar, search-loader, reading-list, notification-stack, pwa, toc-scroll-spy, cite-copy, … |
search.bundle.js | lazy, on first search interaction, ?v=N | vendor/fuse.min.js, search.js |
webmcp.bundle.js | lazy, only when document.modelContext / navigator.modelContext exists (agentic browsers, readiness scanners), ?v=N | webmcp.js — 8 page-level WebMCP tools + the 9 MCP server tools proxied |
library.bundle.js | library pages | library-storage, library-reader, … |
Cache-busting is not uniform — this is the trap. core.bundle.js is referenced with a content-hash ?h=…, so any change auto-busts it. But search.bundle.js is lazy-loaded by search-loader.js with a manual ?v=N tag (not a content hash) under a 7-day CDN cache — so changing search.js alone will not reach returning visitors. You must bump ?v=N in search-loader.js. Because search-loader.js lives in core.bundle.js, bumping it changes core’s content-hash, which busts core’s own cache → the fresh core then requests the new search.bundle.js?v=N+1. webmcp.bundle.js follows the same pattern: bump ?v=N in webmcp-loader.js whenever webmcp.js changes.
Verify a deploy end-to-end along the chain the browser follows: index.html → core.bundle.js?h=… → search.bundle.js?v=….
Configuration options#
# theme.toml
[extra]
multilingual = true
dark_mode = true
search = true
responsive = true
palette = "bifrost"
sections = ["wiki", "timeline", "library", "articles", "news", "sources"]Customization#
Colors#
Edit sass/abstracts/_colors.scss:
$yellow: #f9c74f;
$pink: #f72585;
$lavender: #b5a7d5;
// ... Bifrost paletteSpacing#
Edit sass/abstracts/_variables.scss:
$spacing-md: 1rem;
$spacing-lg: 1.5rem;
$border-radius-md: 0.5rem;Glassmorphism invariants#
Every chrome surface (navbar, search modal, dropdowns, tooltips, FABs, reader popovers) shares one glass recipe: background-color: var(--color-navbar-bg) (~10% alpha per theme) plus backdrop-filter: blur(...). Two rules keep it rendering identically on every engine:
No transformed ancestors above a glass surface. WebKit (iOS and macOS Safari) silently refuses to render
backdrop-filteron any element that has a transformed ancestor — including identity transforms liketranslateY(0)and transforms that only exist mid-animation. Center overlays withleft: 0; right: 0; margin-inline: autoor a JS-measuredleft, nevertranslateX(-50%); animate position withtop, and use fade-only entrances for surfaces whose blur lives on a child or::before. A transform on the blurred element itself is fine (the FABs rely on this).Fallback lives in the token, not the component. Engines with no
backdrop-filtersupport at all get a near-opaque surface via a single@supports not (...)override of--color-navbar-bginsass/themes/_init.scss— the same mechanism theprefers-reduced-transparencyoverride uses. Never hardcode a per-component opaque fallback.Never put
backdrop-filteron repeated or closed elements. WebKit promotes every backdrop-filter element to its own compositing layer, even atopacity: 0. Past a budget iOS Safari silently drops every blur on the page — navbar and FABs included. On library book pages the per-paragraph action decks (759 in The Book Which Tells the Truth) and closed commentary popovers did exactly that (found 2026-11-07 in the iOS Simulator; desktop Chrome never shows it). Gate the blur on the open state (--selected,.is-open), and share one element where a page needs many (the claim notes do). The same rule bit search: locking scroll by pinning<body>withposition: fixed; top: -scrollYmade WebKit stop painting the fixed navbar (and the search field in it) — lock the root element instead (html:has(body.<state>) { overflow: hidden }), as the burger menu and reading list do.Verify glass in the iOS Simulator (
xcrun simctl), not in headless Chrome or a WKWebView snapshot — neither renders the failure.