How to supress "page not found" error?

I have some markdown files, which I want to automatically process to the hugo-ready format. Particularly. I change hyperlinks to this format. I have some include files from another repo in my hugo project. These files contain relative links, which lead to REF_NOT_FOUND error. How to supress this error and load a 404 page for dead links?

Your question is not very clear, but it sounds like your markdown has something like:

[Foo]({{< relref "/foo.md" >}})

By default, if the target does not exist, Hugo will throw an error when building the site, causing the build to fail.

You can change the error to a warning in your site configuration, and specify a URL to use when the warning is triggered. For example:

refLinksErrorLevel = 'warning'
refLinksNotFoundURL = '/404'

https://gohugo.io/content-management/cross-references/#ref-and-relref-configuration

2 Likes

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