Skip to content

fix(export): Zola links survive a sub-directory deploy (REQ-115/116/118)#377

Merged
avrabe merged 2 commits into
mainfrom
fix/zola-export-subpath-links
Jun 1, 2026
Merged

fix(export): Zola links survive a sub-directory deploy (REQ-115/116/118)#377
avrabe merged 2 commits into
mainfrom
fix/zola-export-subpath-links

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Jun 1, 2026

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:

REQ Site Before After
REQ-115 artifact cross-links (links_md) [T](/rivet/artifacts/req-001/) [T](@/rivet/artifacts/req-001.md)
REQ-118 document [[ID]] wiki-links [ID](/rivet/artifacts/id/) [ID](@/rivet/artifacts/id.md)
REQ-116 rivet_artifact shortcode card href="/{{ prefix }}/artifacts/…" href="{{ get_url(path=…) }}"

Markdown uses Zola internal links (@/…md, resolved against base_url); the shortcode (a Tera template) uses get_url(…). Both honour a sub-directory base_url.

Loud-fail without breaking the build

A dangling @/ internal link aborts zola 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

  • Empirical, end-to-end: scaffolded a Zola site with base_url = "https://example.github.io/rivet-docs", exported the rivet corpus with --shortcodes, ran a real zola build: 861 pages, 0 orphan, 0 errors; 504 artifact links rewritten to keep the /rivet-docs sub-path; 0 generated absolute links remaining. Shortcode card rendered https://example.github.io/rivet-docs/rivet/artifacts/req-001.
  • Regression test (rivet-cli/tests/export_zola.rs): asserts the generated markdown uses @/…md (not absolute ](/rivet/artifacts/) and the shortcode uses get_url( (not a hardcoded absolute href). Asserts on generated content, not a live build, since CI runners have no zola.

The HTML-export half of REQ-118 was already handled by REQ-105's rewrite_static_links (rewrites href/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

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
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

📐 Rivet artifact delta

Change Count
Added 1
Removed 0
Modified 3
Downstream impacted (depth ≤ 5) 0

Graph

graph 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
Loading
Added
  • REQ-138
Modified
ID Changes
REQ-115
REQ-116
REQ-118

📎 Full HTML dashboard attached as workflow artifact rivet-delta-pr-377download from the workflow run.

Posted by rivet-delta workflow. The graph shows only changed artifacts; open the HTML dashboard (above) for full context.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@avrabe avrabe merged commit a8167b1 into main Jun 1, 2026
22 of 39 checks passed
@avrabe avrabe deleted the fix/zola-export-subpath-links branch June 1, 2026 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant