Duplicate path elements in 'Next' links

The FreeBSD documentation project uses Hugo for its website. There a good amount of build infrastructure around it allowing it to produce HTML output, and PDF output.

Very simply, in the rendered PDF output all “Next” links, except the first one, have a duplicated path element:

FreeBSD/public/en/books/porters-handbook/porters-handbook/uses/index.html

The first one is correct:
FreeBSD/public/en/books/porters-handbook/uses/index.html

but all the others are duplicated like the first example above.

Is this a Hugo layout problem? A theme problem?

How do I begin to fix this problem?

Any help most appreciated!
Jim B.

FreeBSD sounds like the repository with the documentation might be publicly available? If so… link please.

If not:

  • clicking the links - does it end up on a 404? sounds like a layout file issue. show the code of the layout where the prev/next links are created/added to the output.
  • if it does not end up on a 404 it might be either a content issue (how does the content directory/file structure up to “porters-handbook” look like? include filenames, because index.md and _index.md might mean something different in each context.
  • it might also be a configuration issue. show your main configuration (everything not under a [section] and your language configuration (everything under [language].

But as I said in the beginning, show the full repo if you can.

From a black-box perspective I would say your layout has some hardcoded paths in it.

https://github.com/freebsd/freebsd-doc/blob/b6d0cb225b382ec2b43a4eec573b3f1bdd1b87cf/documentation/themes/beastie/layouts/books/list.html#L111

You have similar (but working) logic for determining the previous page.
Also look at documentation/themes/beastie/layouts/books/single.html.

Using and parsing front matter to determine next/prev pages seems like a complicated and fragile approach to navigation.

Thanks for your note!

The repo is at: git clone doc - FreeBSD documentation tree ~/doc

It is quite large as it contains all the FreeBSD documentation, books, articles, the website content, translations, etc., roughly 587MB. Almost all the page source is written in Asciidoc, so no markdown :-).

The Hugo theme and related code is in ~/doc/website/themes/beastie and there are some customization. The basic theme framework is intact and works fine for the website.

Source content for all books, such as the porters-handbook is found in
~/doc/documentation/content/en/books/porters-handbook and various subdirectories.
It is only when making so-called offline content that there is a problem with duplicated path elements.

Note that source content contains a mixture of hugo and asciidoctor statements.

To build, there are a number of prerequisites, which are probably out of scope for you. You would have to install several other FreeBSD packages. The entire documentation project is described at FreeBSD Documentation Project Primer for New Contributors | FreeBSD Documentation Portal

It is quite likely that the problem lies in the interaction of front matter (next, previous statements at the top of each file), and something in the layout.

That is where I’m focusing at the moment.

Keep in mind, this only happens when “offline content” is built. If you look at this book on the website, all the “Next” links work fine.

Here is an image of the first page. The path at the bottom appears when hovering over the “Next” link. The link is fine.

And here is an image of the second page. This page and all later pages have a path element duplicated. Clicking on the “Next” link results in an error.

Thanks for any advice you can give me.

Jim B.

Thanks for your note.

Yes, I think there is some interaction with the layout, the theme, and the way the build process is set up (see previous answer).

I will be looking closely at the layout link you posted.

Thanks,
Jim B.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.