Skip to content

Commit 4db1c15

Browse files
committed
Enhance page header partial to support dynamic background and gradient overrides; update 404 page with custom icon and gradient configuration.
1 parent 65e5053 commit 4db1c15

2 files changed

Lines changed: 22 additions & 8 deletions

File tree

adscian/layouts/404.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
{{ define "main" }}
2-
{{ partial "components/page-header.html" (dict "Title" (i18n "page_not_found") "Section" "404") }}
2+
{{ partial "components/page-header.html" (dict "Title" (i18n "page_not_found") "Section" "404" "icon" "la-exclamation-triangle" "bg_gradient_start" "rgba(255, 0, 0, 0.8)" "bg_gradient_end" "rgba(0, 0, 0, 0.8)") }}
33
<section class="section">
44
<div class="container">
55
<div class="row">
66
<div class="col-lg-10 mx-auto text-center">
7-
<a href="{{ site.BaseURL | relLangURL }}" class="btn btn-primary"
8-
>{{ i18n "back_to_home" }}</a
9-
>
7+
{{ $languages := slice }}
8+
{{ range site.Languages }}
9+
{{ $languages = $languages | append .Lang }}
10+
{{ end }}
1011
<script>
1112
// Simple language redirection logic for 404
1213
(function() {
1314
var path = window.location.pathname;
14-
var languages = ["fr", "nl"];
15+
var languages = JSON.parse('{{ $languages | jsonify | safeJS }}');
1516
for (var i = 0; i < languages.length; i++) {
1617
var lang = languages[i];
1718
if (path.indexOf("/" + lang + "/") === 0 && path.indexOf("/" + lang + "/404.html") === -1) {
18-
window.location.href = "/" + lang + "/404.html";
19+
window.location.href = "{{ site.BaseURL | relURL }}" + lang + "/404.html";
1920
return;
2021
}
2122
}

adscian/layouts/partials/components/page-header.html

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
{{ $bg_image := .Params.bg_image | default "images/SRE_Landsat_h1600.jpg" }}
2+
{{ if reflect.IsMap . }}
3+
{{ if .bg_image }}{{ $bg_image = .bg_image }}{{ end }}
4+
{{ end }}
25
{{ $bg_image_resource := resources.Get $bg_image }}
36

47
{{/* Gradient configuration */}}
58
{{ $bg_gradient_angle := .Params.bg_gradient_angle | default site.Params.page_header_bg_gradient.angle | default "45deg" }}
69
{{ $bg_gradient_start := .Params.bg_gradient_start | default site.Params.page_header_bg_gradient.start | default "rgba(25, 165, 82, 0.9)" }}
710
{{ $bg_gradient_end := .Params.bg_gradient_end | default site.Params.page_header_bg_gradient.end | default "rgba(0, 166, 191, 0.9)" }}
811

12+
{{ if reflect.IsMap . }}
13+
{{ if .bg_gradient_angle }}{{ $bg_gradient_angle = .bg_gradient_angle }}{{ end }}
14+
{{ if .bg_gradient_start }}{{ $bg_gradient_start = .bg_gradient_start }}{{ end }}
15+
{{ if .bg_gradient_end }}{{ $bg_gradient_end = .bg_gradient_end }}{{ end }}
16+
{{ end }}
17+
918
<section class="page-header" {{ if $bg_image_resource }} style="background-image: linear-gradient({{ $bg_gradient_angle | safeCSS }}, {{ $bg_gradient_start | safeCSS }}, {{ $bg_gradient_end | safeCSS }}), url('{{ $bg_image_resource.RelPermalink | safeURL }}');" {{ end }}>
1019
<div class="container-xxl">
1120
<div class="row">
@@ -14,8 +23,12 @@
1423
<div class="section-title text-center mb-0">
1524
<div class="icon mx-3" style="color: #dbf0e9;" data-aos="flip-left" data-aos-easing="ease-out-cubic"
1625
data-aos-duration="3000">
17-
{{if isset .Params "icon"}}
18-
<i class="las {{.Params.icon}}" style="font-size:64px;"></i>
26+
{{ $icon := .Params.icon }}
27+
{{ if reflect.IsMap . }}
28+
{{ if .icon }}{{ $icon = .icon }}{{ end }}
29+
{{ end }}
30+
{{ if $icon }}
31+
<i class="las {{$icon}}" style="font-size:64px;"></i>
1932
{{ end }}
2033
</div>
2134
<div class="header-frame my-3 py-3">

0 commit comments

Comments
 (0)