Skip to content

v0.4.6 — a relative markdown link resolves against its own page

Choose a tag to compare

@edadma edadma released this 06 Sep 00:21
· 2 commits to stable since this release

A relative link destination was absolutized against the site root with its extension left on, so [Patterns](patterns.md) written in content/reference/types.md rendered as href="/patterns.md" — a 404 from every page below the root, and a silent one.

A relative destination now resolves against the directory of the source page, and one that lands on another content file becomes that file's rendered URL:

  • patterns.md beside types.md → /reference/patterns/
  • ../library/http.md → /library/http/
  • patterns.md#guards keeps its fragment → /reference/patterns/#guards
  • a directory's index file (_index.md, or README.md where folderContent names it) → the section's own URL, as does a link to the directory itself
  • a relative link to something that is not a page (a bundle image, a download) → the path that file is published at
  • site-absolute, external, mailto: and fragment-only destinations are untouched

That is what lets one markdown file be correct in the repository and on the site.

Backlinks are now collected from the resolved document, so a page reached only by relative links knows who points at it, and a subpath deploy's backlinks match for the first time.

314 tests green on the JVM; the Native binary links.