feat: add 404 error page layout and update topbar for 404 handling

This commit is contained in:
geekifan
2025-05-11 18:18:48 +08:00
parent f615f3bd8a
commit 5ca8472fb7
2 changed files with 7 additions and 1 deletions

6
layouts/404.html Normal file
View File

@ -0,0 +1,6 @@
{{ define "main" }}
<h1 class="dynamic-title">404: Page not found</h1>
<div class="content">
<blockquote class="prompt-danger"><p>{{ i18n "not_found.statement" }}</p></blockquote>
</div>
{{ end }}

View File

@ -59,7 +59,7 @@
<div id="topbar-title"> <div id="topbar-title">
{{ if eq .Layout "home" }} {{ if eq .Layout "home" }}
{{- .Site.Title -}} {{- .Site.Title -}}
{{ else if or (eq .Type "tabs") (eq .Kind "page") }} {{ else if or (eq .Type "tabs") (eq .Kind "page") (eq .Kind "404") }}
{{- T (printf "tabs.%s" (path.Base $url)) | default .Title -}} {{- T (printf "tabs.%s" (path.Base $url)) | default .Title -}}
{{ else }} {{ else }}
{{- T (printf "layout.%s" .Layout) | default (.Layout | title) -}} {{- T (printf "layout.%s" .Layout) | default (.Layout | title) -}}