Portable Links

Quarto Extension

See the extension overview for installation and usage.

What it does

In a Quarto website or book, relative links to other pages resolve only within the HTML site. When the document is rendered to a non-HTML format (PDF, DOCX, Typst), those pages do not exist alongside the output and the links break. This filter rewrites them to absolute URLs built from the project’s site-url.

This page renders to HTML, where relative cross-page links already work, so the filter leaves them untouched.

Before and after

With this project’s site-url, a non-HTML render produces:

Source Rewritten target
methods.qmd https://m.canouil.dev/quarto-portable-links/methods.html
appendix.html#notes https://m.canouil.dev/quarto-portable-links/appendix.html#notes
search.html?q=portable https://m.canouil.dev/quarto-portable-links/search.html?q=portable
chapters/02-intro.qmd https://m.canouil.dev/quarto-portable-links/chapters/02-intro.html
/chapters/03-summary.qmd https://m.canouil.dev/quarto-portable-links/chapters/03-summary.html
./chapters/04-discussion.qmd https://m.canouil.dev/quarto-portable-links/chapters/04-discussion.html