要在Hugo主题中添加自定义404页面非常简单,只需要在主题目录中添加一个404的html模版即可: {{ theme }}/layouts/404.html


{{ define "main" }}

<main>

    <br><br>    
    <h1>We couldn't find this Page!</h1>

    <p>
        Please try our search page to look for it or go back 
        to the <a href="/">home page</a>.
    </p>

</main>

{{ end }}

可以查看本站点的404页面示例 https://www.gopherloveapple.com/404

HTTP 404日历图