Page MenuHomeFreeBSD

docs: fix broken cross-references by using numeric values for isOnline
ClosedPublic

Authored by vladlen on May 19 2026, 6:03 PM.
Tags
Referenced Files
Unknown Object (File)
Tue, Jun 23, 2:16 AM
Unknown Object (File)
Thu, Jun 11, 4:05 AM
Unknown Object (File)
Sun, Jun 7, 11:05 AM
Unknown Object (File)
Sun, Jun 7, 11:03 AM
Unknown Object (File)
Sat, Jun 6, 5:10 PM
Unknown Object (File)
Sat, Jun 6, 5:07 PM
Unknown Object (File)
Thu, Jun 4, 8:09 PM
Unknown Object (File)
Thu, Jun 4, 8:05 PM
Subscribers
None

Details

Summary

The problem: On the FreeBSD documentation portal, cross-reference links inside books and articles are generated incorrectly. Both the extref and crossref Asciidoctor macros produce wrong URLs (for example, offline-style paths like ../path/index.html#anchor are used instead of the correct online paths). This makes navigation between chapters and books broken for users reading the documentation online.
It is reported in PR 295112.

The same issue affects the en-freebsd-doc package (version 20260508,1). In that package, instead of generating links to local files (as expected for offline use), the broken code produces links pointing to the external web server.

Root cause: The Hugo configuration passes the isOnline attribute as a boolean (true/false) inside [markup.asciidocExt.attributes]. However, the Ruby extensions in Asciidoctor compare this attribute with the string "1":

if doc.attributes['isonline'] == "1"

Because true is not equal to "1", the condition always evaluates to false. As a result, the extensions always choose the offline link generation branch, breaking both online and offline builds in different ways.

Why did it work before? Older Hugo versions (or a different Asciidoctor integration) likely converted boolean true/false into "1"/"0" automatically. That conversion no longer happens, so we need to make the values explicit. I am not sure about this, I do not have old hugo version and cannot check it.

The fix: Replace isOnline = true with isOnline = 1 and isOnline = false with isOnline = 0 in both hugo.toml (online) and the offline config.toml. This matches the expected string values in the Ruby code and restores correct link generation for both the live website and the offline package.

Diff Detail

Repository
R9 FreeBSD doc repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

vladlen created this revision.

Go ahead, and also with the change in the JavaScript for the website.
I put a comment in the other review.

Thanks for your hard work!

This revision is now accepted and ready to land.May 19 2026, 6:48 PM

We still have a broken link in the site footer (community/get involved >> it's missing the /en/ in the name). I opened https://reviews.freebsd.org/D57064, but I know this is not the correct fix. How did you realize this was the issue?