Bifrost Theme

The multilingual reading theme — templates, shortcodes, SCSS architecture, and how to extend it.

≈ 8 min read 1442 words Updated 2026-11-28

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#

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/bifrost

Update 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 modules

Templates#

Section templates#

TemplateSection
wiki-section.htmlWiki index
timeline-section.htmlTimeline / ages index
library-section.htmlBook library index
articles-section.htmlArticles index
news-section.htmlNewsroom dispatches index
sources-section.htmlJSON-driven bibliography page

Page templates#

TemplateContent type
wiki-page.htmlWiki entries
timeline-page.htmlPrecessional ages
library-book.htmlBook reader
articles-page.htmlLong-form essays
news-page.htmlNewsroom dispatches
info-page.htmlStandalone pages (about, press, contact)

Shortcodes#

ShortcodeUsage
figureResponsive images with CDN
citeCitation references
definitionTerm definitions
infoInfo boxes
linkInternal links
refCross-references
referenceBibliography entries
authorAuthor attribution
libraryLibrary 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#

ModulePurpose
navbar.jsNavigation behavior
search.jsClient-side search
library-reader.jsBook reading UI
library-storage.jsPersistence layer
library-study-tools.jsBookmarks, highlights
library-search.jsIn-book search
pwa.jsService worker
toc-scroll-spy.jsToC highlighting
to-top.jsScroll to top
timeline.jsTimeline interactions
reading-list.jsReading list feature

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 -c

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:

  1. Edit the source module.
  2. mise run bundle (or cd themes/bifrost && npm run bundle) — runs scripts/bundle.js (esbuild) and rewrites static/js/dist/*.bundle.js.
  3. Commit the regenerated dist/*.bundle.js artifact alongside the source. mise run build also bundles first, but a plain zola build serves the committed bundle — so it must be up to date in git.

Entry points are declared in themes/bifrost/scripts/bundle.js:

BundleLoadedContains
core.bundle.jsevery page, ?h=<contenthash>navbar, search-loader, reading-list, notification-stack, pwa, toc-scroll-spy, cite-copy, …
search.bundle.jslazy, on first search interaction, ?v=Nvendor/fuse.min.js, search.js
webmcp.bundle.jslazy, only when document.modelContext / navigator.modelContext exists (agentic browsers, readiness scanners), ?v=Nwebmcp.js — 8 page-level WebMCP tools + the 9 MCP server tools proxied
library.bundle.jslibrary pageslibrary-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 palette

Spacing#

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:

  1. No transformed ancestors above a glass surface. WebKit (iOS and macOS Safari) silently refuses to render backdrop-filter on any element that has a transformed ancestor — including identity transforms like translateY(0) and transforms that only exist mid-animation. Center overlays with left: 0; right: 0; margin-inline: auto or a JS-measured left, never translateX(-50%); animate position with top, 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).

  2. Fallback lives in the token, not the component. Engines with no backdrop-filter support at all get a near-opaque surface via a single @supports not (...) override of --color-navbar-bg in sass/themes/_init.scss — the same mechanism the prefers-reduced-transparency override uses. Never hardcode a per-component opaque fallback.

  3. Never put backdrop-filter on repeated or closed elements. WebKit promotes every backdrop-filter element to its own compositing layer, even at opacity: 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> with position: fixed; top: -scrollY made 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.

Edit this page on GitHub