Skip to content

Commit ab57124

Browse files
committed
List: Added date checker + moved to partial + added banner to every page
1 parent c3f2c80 commit ab57124

File tree

4 files changed

+26
-17
lines changed

4 files changed

+26
-17
lines changed

layouts/_default/docs.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
{{ else }}
6767
<main class="content col d-block align-top content-no-toc" role="main">
6868
{{ end }}
69-
69+
7070
<section class="main-layout">
7171
<div class="sidebar-layout" id="sidebar-layout">
7272
<button class="sidebar__mobile__toggle" aria-expanded="false" data-mf="true">{{ partial "lucide" (dict "context" . "icon" "x")}}Close</button>
@@ -84,6 +84,7 @@
8484
{{ end }}
8585
{{ end }}
8686
</section>
87+
{{ partial "banner" .}}
8788
<h1>{{ .Title }}</h1>
8889
{{ $content | safeHTML }}
8990
{{ if eq .Page.Draft true }}{{ partial "draft-badge.html" . }}{{ end }}

layouts/_default/list.html

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,7 @@
3131
<h1>{{ .Title }}</h1>
3232
{{ .Content }}
3333

34-
{{- with .Params.banner -}}
35-
{{- if .enabled -}}
36-
{{- $bannerPage := site.GetPage .md -}}
37-
<div class="banner banner-{{ .type }}">
38-
{{ $bannerPage.Content }}
39-
</div>
40-
{{- end -}}
41-
{{- end -}}
34+
{{ partial "banner" .}}
4235

4336
{{ if (lt .WordCount 1) }}
4437
{{ range .Pages.ByWeight }}

layouts/partials/banner.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{- with .Params.banner -}}
2+
{{- if .enabled -}}
3+
<!-- Gather the dates and default to beginning or end of time if frontmatter is not provided -->
4+
{{- $currentDate := now | dateFormat "2006-01-02" -}}
5+
{{- $startDate := index . "start-date" | default "0001-01-01" -}}
6+
{{- $endDate := index . "end-date" | default "9999-12-31" -}}
7+
8+
<!-- Checks that the current date is within bounds-->
9+
{{- if and (ge $currentDate $startDate) (le $currentDate $endDate) -}}
10+
{{- if isset . "md" -}}
11+
<!-- Show markdown if "md" is provided -->
12+
{{- $bannerPage := site.GetPage .md -}}
13+
<div class="banner banner-{{ .type }}">
14+
{{ $bannerPage.Content }}
15+
</div>
16+
{{- else -}}
17+
<!-- Show default banner if "md" is NOT provided -->
18+
19+
{{- end -}}
20+
{{- end -}}
21+
{{- end -}}
22+
{{- end -}}

layouts/partials/list-main.html

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,7 @@ <h1 class="bd-title">
1818
</div>
1919
</div>
2020

21-
{{- with .Params.banner -}}
22-
{{- if .enabled -}}
23-
{{- $bannerPage := site.GetPage .md -}}
24-
<div class="banner banner-{{ .type }}">
25-
{{ $bannerPage.Content }}
26-
</div>
27-
{{- end -}}
28-
{{- end -}}
21+
{{ partial "banner" .}}
2922

3023
{{ if or (lt .WordCount 1) (eq $PageTitle "F5 NGINX One Console") (eq $PageTitle "F5 NGINX App Protect DoS") (eq $PageTitle "F5 NGINX Plus") }}
3124
<section>

0 commit comments

Comments
 (0)