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?
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.)
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.