diff --git a/share/mrdocs/addons/generator/adoc/layouts/wrapper.adoc.hbs b/share/mrdocs/addons/generator/adoc/layouts/wrapper.adoc.hbs index 2cb49def5f..0db5dd957c 100644 --- a/share/mrdocs/addons/generator/adoc/layouts/wrapper.adoc.hbs +++ b/share/mrdocs/addons/generator/adoc/layouts/wrapper.adoc.hbs @@ -9,7 +9,32 @@ Breadcrumbs are included in the symbol template as an alternative. }} -= {{> symbol/qualified-name symbol nolink=true }} += {{> symbol/qualified-name symbol }} +{{! + Antora does not support relative links to pages in + parent directories. Therefore, unlike in HTML templates, + links are not relativized. + + However, while Antora interprets xref as relative + to the root of the module, these xref are + interpreted as relative to the current directory + because it has no concept of modules. This means + links would be broken with either Antora or Asciidoc. + + Even more, Antora uses the same rule as Asciidoc + for breadcrumbs and the page title, where links + would also be broken. + + The solution is to set the relfileprefix attribute, + which includes the relative location of the root + directory and makes all links relative to it. + + This relfileprefix affects Asciidoc links, the + Antora title, and the Antora breadcrumbs. + + See https://docs.asciidoctor.org/asciidoc/latest/macros/inter-document-xref/#mapping-references-to-a-different-structure +}} +:relfileprefix: {{{ repeat "../" (count (remove_prefix symbol.url '/') '/') }}} {{else}} {{! Single page documentation: symbol is not available to the wrapper }} = Reference diff --git a/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs b/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs index 4851f431c3..c2e2d90b9b 100644 --- a/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs +++ b/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs @@ -21,18 +21,6 @@ {{#if symbol.doc.brief}} {{{symbol.doc.brief}}} -{{/if}} -{{! Breadcrumbs - - The antora breadcrumbs do not work with the multipage documentation. - - This includes symbol/qualified-name here as an alternative for users - to visit parent scopes. -}} -{{#if @root.config.multipage }} -{{#> markup/code-block }} -{{> symbol/qualified-name symbol }} -{{/markup/code-block}} {{/if}} {{! Synopsis }} {{#unless (eq symbol.kind "namespace")}}