Summary
In multi-page HTML output, the use of the <base> tag currently shifts URL resolution in a way that breaks two distinct types of resources: user-authored relative images and system-injected KaTeX assets.
This issue aims to clarify the expected behavior for these links and document where the current multi-page output diverges from that expectation.
Expected Behavior (Proposed Link Resolution Rules)
To ensure a predictable experience for Verso authors, links and assets should conceptually resolve as follows:
- User-authored relative paths: If an author includes a relative link or image in a Markdown file (e.g.,
), that path should resolve relative to the location of that specific page within the project structure.
- System-injected internal assets: Internal Verso assets (like KaTeX scripts mapped to
/-verso-data/katex/...) should reliably resolve to the generated site-root directory, regardless of how deeply nested the current page is.
Reproduction
Setup:
- Verso
v4.29.0, multi-page HTML output enabled.
- KaTeX feature enabled.
- A nested page created at the path:
Verification/Key-Theorems/
- The Markdown content for that page includes a local image reference:

Actual Behavior
Because the generator injects <base href="./../../"> on the nested page, it alters the base URL for the entire document, breaking both rules defined above:
1. Markdown Images (Overshoots local directory)
The relative image  is rendered in the HTML as <img src="graphs/foo.svg">.
Because of the <base> tag, the browser resolves this from the site root rather than the page directory.
- Expected:
{site-root}/Verification/Key-Theorems/graphs/foo.svg
- Actual:
{site-root}/graphs/foo.svg (404)
2. KaTeX Assets (Overshoots site root)
Absolute internal assets like /-verso-data/katex/katex.js are currently relativized by the compiler to ../../-verso-data/katex/katex.js.
Because the <base> tag already navigates the browser back to the site root, the additional ../../ prefix causes the browser to overshoot the root entirely.
- Expected:
{site-root}/-verso-data/katex/katex.js
- Actual:
{two-levels-above-site-root}/-verso-data/katex/katex.js (404)
Browser console output shows:
GET https://example.com/pages/-verso-data/katex/katex.js net::ERR_ABORTED 404
Proposed Fix
I have identified the root causes for both of these URL resolution issues in Html.lean and VersoManual.lean and opened a PR with a proposed fix here: #835
The PR adjusts the compiler to ensure user-authored relative paths are prefixed with their page path before the <base> tag shifts resolution, and prevents absolute asset URLs from generating redundant ../ sequences.
Summary
In multi-page HTML output, the use of the
<base>tag currently shifts URL resolution in a way that breaks two distinct types of resources: user-authored relative images and system-injected KaTeX assets.This issue aims to clarify the expected behavior for these links and document where the current multi-page output diverges from that expectation.
Expected Behavior (Proposed Link Resolution Rules)
To ensure a predictable experience for Verso authors, links and assets should conceptually resolve as follows:
), that path should resolve relative to the location of that specific page within the project structure./-verso-data/katex/...) should reliably resolve to the generated site-root directory, regardless of how deeply nested the current page is.Reproduction
Setup:
v4.29.0, multi-page HTML output enabled.Verification/Key-Theorems/Actual Behavior
Because the generator injects
<base href="./../../">on the nested page, it alters the base URL for the entire document, breaking both rules defined above:1. Markdown Images (Overshoots local directory)
The relative image
is rendered in the HTML as<img src="graphs/foo.svg">.Because of the
<base>tag, the browser resolves this from the site root rather than the page directory.{site-root}/Verification/Key-Theorems/graphs/foo.svg{site-root}/graphs/foo.svg(404)2. KaTeX Assets (Overshoots site root)
Absolute internal assets like
/-verso-data/katex/katex.jsare currently relativized by the compiler to../../-verso-data/katex/katex.js.Because the
<base>tag already navigates the browser back to the site root, the additional../../prefix causes the browser to overshoot the root entirely.{site-root}/-verso-data/katex/katex.js{two-levels-above-site-root}/-verso-data/katex/katex.js(404)Browser console output shows:
GET https://example.com/pages/-verso-data/katex/katex.js net::ERR_ABORTED 404Proposed Fix
I have identified the root causes for both of these URL resolution issues in
Html.leanandVersoManual.leanand opened a PR with a proposed fix here: #835The PR adjusts the compiler to ensure user-authored relative paths are prefixed with their page path before the
<base>tag shifts resolution, and prevents absolute asset URLs from generating redundant../sequences.