Use 404.svg image if available.

This commit is contained in:
2026-06-28 14:50:53 +02:00
parent ba12b11f03
commit 6d3fb4613b
2 changed files with 28 additions and 6 deletions
+12
View File
@@ -1,3 +1,15 @@
# hugo_bootstrap_theme # hugo_bootstrap_theme
Simple Bootstrap-based theme for Hugo. Simple Bootstrap-based theme for Hugo.
## Custom error page
The theme has a custom 404 error page.
If the site has an SVG image in `assets/svg/404.svg`,
this image will be displayed instead of a generic 404
code. Regardless of whether an SVG assets exists or not,
English and German explanations of what's going on will
be included on the page.
+16 -6
View File
@@ -1,11 +1,19 @@
{{ define "main" }} {{ define "main" }}
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col"> <div class="col mt-5 mb-5">
<h1 class="display-1 mx-auto text-center"> {{ with resources.Get "svg/404.svg" }}
404 {{ .Content | safeHTML }}
</h1> {{ else }}
<div class="alert alert-danger mb-5"> <h1 class="display-1 mx-auto text-center">
404
</h1>
{{ end }}
</div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="alert alert-danger mb-5" lang="en">
<h4 class="alert-heading"> <h4 class="alert-heading">
Page not found Page not found
</h4> </h4>
@@ -18,7 +26,9 @@
<a href="{{ .Site.BaseURL }}" class="alert-link">Back to the home page.</a> <a href="{{ .Site.BaseURL }}" class="alert-link">Back to the home page.</a>
</p> </p>
</div> </div>
<div class="alert alert-warning"> </div>
<div class="col-lg-6">
<div class="alert alert-danger" lang="de">
<h4 class="alert-heading"> <h4 class="alert-heading">
Seite nicht gefunden Seite nicht gefunden
</h4> </h4>