Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken links in breadcrumbs outside nav #372

Open
alandefreitas opened this issue Dec 2, 2024 · 3 comments
Open

Broken links in breadcrumbs outside nav #372

alandefreitas opened this issue Dec 2, 2024 · 3 comments
Assignees
Labels
Bug A problem with the UI or stylesheets

Comments

@alandefreitas
Copy link
Member

When pages are not in the nav.adoc, the Antora UI creates broken links in the breadcrumbs and page titles.

To replicate the issue include the following files in any project:

// modules/ROOT/nav.adoc
# ...
* xref:root-link.adoc[]
# ...
// modules/ROOT/pages/root-link.adoc
= Root link

xref:test:A.adoc[A]

// modules/test/pages/A.adoc
= A with a link to xref:B/B.adoc[B]

Link to xref:B/B.adoc[B]
// modules/test/pages/B/B.adoc
= B with a link to xref:A.adoc[A]

Link to xref:A.adoc[A]

The links in B will be broken in the breadcrumbs and the title, but not in the content of the B.adoc file.

@rbbeeston rbbeeston added the Bug A problem with the UI or stylesheets label Dec 2, 2024
@rbbeeston rbbeeston moved this to Accepted in website-v2 Dec 2, 2024
@julioest julioest moved this from Accepted to In Progress in website-v2 Dec 2, 2024
@alandefreitas
Copy link
Member Author

I've been investigating this issue. The problem is that Asciidoc and Antora have different behaviors for xrefs and, to make it worse, Antora uses the Asciidoc behavior for the title.

So Antora doesn't support relative paths, and all xrefs must be relative to the module pages. So xref:a/b.adoc renders as <module>/a/b.html.

On the other hand, Asciidoc supports relative paths and paths are rendered relative to the current page. So xref:a/b.adoc renders as <current page>/a/b.html.

These two things are not the same. So unless all pages are in the root module pages, we would have broken links either in Antora or Asciidoc. To make things worse, Antora uses the default Asciidoc behavior for the title, so

= xref:a/b.adoc

xref:a/b.adoc

would render as <current page>/a/b.html and then <module>/a/b.html for the exact same xref. And breadcrumbs would also have the broken link when it's not in nav.adoc because it just replicates the title.

The solution I found was to set the relfileprefix attribute.

The attribute prepends all xrefs with some prefix (like "../", etc). This fixes the problem with Asciidoc. The solution isn't supposed to be needed in Antora, but it also fixes the problem with titles and breadcrumbs.

So this issue becomes less urgent now that we don't have broken links for the boost documentation 1.87. It's still worth checking the rules the Antora UI uses to render these breadcrumbs and title and see if there's something we can do about it in the general case.

I think most people don't ever have this issue because they don't include links in the title, but MrDocs does.

@rbbeeston
Copy link
Member

Thanks for the info, I think I'll move this to a priority 3 for now, as it shouldn't affect the release, or break anything in the near term related to getting the launch done.

@julioest
Copy link
Collaborator

julioest commented Dec 4, 2024

@julioest julioest moved this from In Progress to On Hold in website-v2 Dec 16, 2024
@rbbeeston rbbeeston assigned cdw9 and unassigned julioest Jan 6, 2025
@cdw9 cdw9 assigned julioest and unassigned cdw9 Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A problem with the UI or stylesheets
Projects
Status: On Hold
Development

No branches or pull requests

4 participants