Add warning banner for older blog posts (#12366)

Signed-off-by: Faseela K <faseela.k@est.tech>

Signed-off-by: Faseela K <faseela.k@est.tech>
This commit is contained in:
Faseela K 2022-12-19 23:59:23 +01:00 committed by GitHub
parent 917092c9a6
commit 6481a40999
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 0 deletions

View File

@ -5,6 +5,30 @@
<p>{{ .Params.description }}</p>
</div>
<p class="post-author">{{ (.Params.publishdate).Format "Jan 2, 2006" }} <span> | </span> By {{ replace (replace .Params.attribution "(" "- ") ")" "" }}</p>
{{ if .Page.Params.target_release }}
{{ $page_parts := split .Page.Params.target_release "." }}
{{ $page_version := int (index $page_parts 0) }}
{{ $page_revision := int (index $page_parts 1) }}
{{ $page_normalized_version := add (add (mul $page_version 1000000) (mul $page_revision 1000)) 0 }}
{{ $site_parts := split .Site.Data.args.version "." }}
{{ $site_version := int (index $site_parts 0) }}
{{ $site_revision := int (index $site_parts 1) }}
{{ $site_normalized_version := add (add (mul $site_version 1000000) (mul $site_revision 1000)) 0 }}
{{ if gt $site_normalized_version $page_normalized_version }}
<div>
<aside class="callout warning">
<div class="type">
{{- partial "large_icon.html" "callout-warning" -}}
</div>
<div class="content">
{{ printf (i18n "target_release") .Page.Params.target_release }}
</div>
</aside>
</div>
{{ end }}
{{ end }}
<div>
{{ .Content }}
</div>