Equivalent to ref/relref for native HTML file

We general use relrefs in our documentation for links to Markdown files, as obviously that has the benefit that if a link is broken, the local Hugo server immediately shows an error; for example:

see [topic]({{< relref "directory/topic.md" >}}))

However, our docs also include links to some native HTML files (related to API documentation).

[Kotlin API docs](../../../kotlinindex.html)

Is there any way to have a link to a HTML file so that, if it is missing, an immediate error is thrown?

P.

Is the HTML file a content page?

If it is not a content page, is it somewhere in the content directory, the assets directory, or the static directory?

It’s in a directory called “api-ref” under the “content” directory. It’s a content page: the top page of Kotlin API documentation, not generated by Hugo but simply copied into it (that is, not generated from any corresponding Markdown file.)

With which version of Hugo are you building your site?

Also, does the HTML file have front matter?

We’re on an older version, hugo v0.122.0.

No, no front matter. It is material generated by Dokka in the case of Kotlin API docs:

You can do what you want to do with v0.123.0 and later.

This example site requires v0.146.7 or later.

git clone --single-branch -b hugo-forum-topic-54486 https://github.com/jmooring/hugo-testing hugo-forum-topic-54486
cd hugo-forum-topic-54486
hugo server

With the link render hook included in the example site above, you no longer need to use the (essentially obsolete) relref shortcode to resolve (with error reporting) link destinations.

1 Like

Thank you! I’ll look into upgrading ASAP.

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