diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2023-08-27 11:50:19 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2023-08-27 11:50:19 +0530 |
commit | 4d53954be9a98d67531794956f6376bba01af86d (patch) | |
tree | a76071adc0101caf48ace9a9219c4c304ba7905a | |
parent | 68abbb9eb2449a674ec4f8d47ecf44771c8c2ec6 (diff) |
added 404 page
-rw-r--r-- | layouts/404.html | 13 | ||||
-rw-r--r-- | layouts/_default/single.html | 4 | ||||
-rw-r--r-- | layouts/partials/header.html | 20 | ||||
-rw-r--r-- | static/css/styles.css | 1 |
4 files changed, 37 insertions, 1 deletions
diff --git a/layouts/404.html b/layouts/404.html index e69de29..8bcffdd 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -0,0 +1,13 @@ +{{ define "main" }} +<div id="404"> + <h1>(404) The page you requested was not found.</h1> + + {{ if .Site.Params.header404 }} + <img id="header-img" src="{{ index .Site.Params.header404 0 }}" alt="{{ index .Site.Params.header404 1 }}"> + {{ end }} + + <p> + <a href="/">Go back home</a> + </p> +</div> +{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index e0e8308..1ecd70a 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,3 +1,7 @@ {{ define "main" }} + {{ if .Params.headerImg }} + <img id="header-img" src="{{ .Params.headerImg }}" alt="{{ if .Params.headerAlt }}{{ .Params.headerAlt }}{{ else }}Header Image{{ end }}"> + {{ end }} + {{ .Content }} {{ end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index ba1869b..0d8ac71 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -2,7 +2,25 @@ <nav id="global-nav"> {{ range .Site.Params.navLinks }} {{ $path := index . 1 }} - <a href="{{ $path }}" {{ if $.Params.navPath }}{{ $p := printf "/%s" $.Params.navPath | printf "%s" }}{{ if eq $path $p }}id="nav-link-active"{{ end }}{{ else }}{{ $p := printf "/%s" $.Section | printf "%s" }}{{ if eq $path $p }}id="nav-link-active"{{ end }}{{ end }}> + <a href="{{ $path }}" + {{ if $.Params.navPath }} + {{ if ne $.Params.navPath "" }} + {{ $p := printf "/%s" $.Params.navPath | printf "%s" }} + + {{ if eq $path $p }} + id="nav-link-active" + {{ end }} + {{ end }} + {{ else }} + {{ if ne $.Section "" }} + {{ $p := printf "/%s" $.Section | printf "%s" }} + + {{ if eq $path $p }} + id="nav-link-active" + {{ end }} + {{ end }} + {{ end }} + > {{ index . 0 }} </a> {{ end }} diff --git a/static/css/styles.css b/static/css/styles.css index f4df2db..cb3afb4 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -53,6 +53,7 @@ a { #header-img { width: 100%; max-height: auto; + margin: 1rem auto; } img { |