fix(export): Zola links survive a sub-directory deploy (REQ-115/116/118)#377
Merged
Conversation
Artifact cross-links, document `[[ID]]` wiki-links, and the `rivet_artifact` shortcode card all emitted absolute `/<prefix>/artifacts/<slug>/` paths. On a GitHub-Pages-style project site served under `/<repo>/`, an absolute path drops the deploy sub-path and 404s in the browser. - Markdown links (cross-links + wiki-links) now use Zola internal links `@/<prefix>/artifacts/<slug>.md`, which Zola resolves against `base_url`. A target not present in the export degrades to plain text — never an absolute path leak, never a dangling `@/` link that would abort `zola build`. The build-failure relocates to a precise rivet-side membership check instead of an opaque downstream error. - The `rivet_artifact` shortcode card link uses `get_url(path=…)`, which honours `base_url`. Verified end-to-end with a real `zola build` under a sub-directory `base_url`: 504 links rewritten, 0 absolute, 0 dangling, clean build. New `export_zola.rs` integration test pins the generated link forms (asserts on content, not a live build, since CI has no `zola`). The HTML-export half of REQ-118 was already covered by REQ-105's `rewrite_static_links` (rewrites `href`/`hx-get`/`src`), verified by inspecting exported document pages (0 absolute links). Fixes: REQ-115, REQ-116, REQ-118 Verifies: REQ-115, REQ-116, REQ-118 Refs: REQ-004, REQ-105 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…378) Dogfood-filed follow-up to the REQ-115/116/118 fix: the Zola export tests assert on generated strings, so "export succeeded" doesn't imply "the site builds." Captures the product half of the friction reported in #378 — an optional `zola build` smoke job + a buildable-scaffold recipe. Draft; traces-to REQ-115. Refs: REQ-115, REQ-004
📐 Rivet artifact delta
Graphgraph LR
REQ_115["REQ-115"]:::modified
REQ_116["REQ-116"]:::modified
REQ_118["REQ-118"]:::modified
REQ_138["REQ-138"]:::added
classDef added fill:#d4edda,stroke:#28a745,color:#155724
classDef removed fill:#f8d7da,stroke:#dc3545,color:#721c24
classDef modified fill:#fff3cd,stroke:#ffc107,color:#856404
classDef overflow fill:#e2e3e5,stroke:#6c757d,color:#495057,stroke-dasharray: 3 3
Added
Modified
Posted by |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Jun 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Zola export emitted absolute
/<prefix>/artifacts/<slug>/paths in three places. On a GitHub-Pages-style project site served under/<repo>/, an absolute path drops the deploy sub-path and 404s in the browser:links_md)[T](/rivet/artifacts/req-001/)[T](@/rivet/artifacts/req-001.md)[[ID]]wiki-links[ID](/rivet/artifacts/id/)[ID](@/rivet/artifacts/id.md)rivet_artifactshortcode cardhref="/{{ prefix }}/artifacts/…"href="{{ get_url(path=…) }}"Markdown uses Zola internal links (
@/…md, resolved againstbase_url); the shortcode (a Tera template) usesget_url(…). Both honour a sub-directorybase_url.Loud-fail without breaking the build
A dangling
@/internal link abortszola build. So the export builds a set of exported artifact slugs and only emits an internal link when the target is present; otherwise it degrades to plain text — never an absolute-path leak, never a dangling link. The failure for a genuinely-missing target relocates to a precise rivet-side check rather than an opaque downstream Zola error.Verification
base_url = "https://example.github.io/rivet-docs", exported the rivet corpus with--shortcodes, ran a realzola build: 861 pages, 0 orphan, 0 errors; 504 artifact links rewritten to keep the/rivet-docssub-path; 0 generated absolute links remaining. Shortcode card renderedhttps://example.github.io/rivet-docs/rivet/artifacts/req-001.rivet-cli/tests/export_zola.rs): asserts the generated markdown uses@/…md(not absolute](/rivet/artifacts/) and the shortcode usesget_url((not a hardcoded absolute href). Asserts on generated content, not a live build, since CI runners have nozola.The HTML-export half of REQ-118 was already handled by REQ-105's
rewrite_static_links(rewriteshref/hx-get/src) — confirmed by inspecting exported document pages (0 absolute links). No change needed there.Artifacts REQ-115 / REQ-116 / REQ-118 flipped
draft → implemented;rivet validate→ PASS.Fixes: REQ-115, REQ-116, REQ-118
🤖 Generated with Claude Code