Skip to content

Commit 804388f

Browse files
feat: replaced the deprecation-warning partial with docsy provided version-banner and customising it
1 parent 025268b commit 804388f

File tree

9 files changed

+31
-68
lines changed

9 files changed

+31
-68
lines changed

assets/scss/_custom.scss

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,26 +1137,6 @@ body.cid-community #cncf-code-of-conduct h2:after {
11371137
}
11381138
}
11391139

1140-
body.cid-casestudies, body.cid-community, body.cid-partners {
1141-
section#deprecation-warning {
1142-
padding: 0;
1143-
margin: 0;
1144-
width: 100%;
1145-
1146-
border-top: solid 1em $primary;
1147-
border-bottom: solid 1em $primary;
1148-
1149-
// Center the pageinfo
1150-
padding-left: calc(max(1rem, (100vw - 60rem) / 2));
1151-
padding-right: calc(max(1rem, (100vw - 60rem) / 2));
1152-
}
1153-
/* Ensure color overrides */
1154-
section#deprecation-warning, section#deprecation-warning > .pageinfo.deprecation-warning {
1155-
background-color: $primary;
1156-
color: #fff;
1157-
}
1158-
}
1159-
11601140
body.cid-partners {
11611141
/* SECTIONS */
11621142
.section {
@@ -1357,16 +1337,6 @@ body.cid-partners {
13571337
}
13581338
}
13591339
}
1360-
body.cid-community > #deprecation-warning > .deprecation-warning {
1361-
margin-left: 20px;
1362-
margin-right: 20px;
1363-
color: #faf5b6;
1364-
background-color: inherit;
1365-
}
1366-
body.cid-community > #deprecation-warning > .deprecation-warning > * {
1367-
color: inherit;
1368-
background-color: inherit;
1369-
}
13701340

13711341
body.cid-code-of-conduct main {
13721342
max-width: calc(min(90vw, 100em));
@@ -1406,22 +1376,6 @@ body.cid-code-of-conduct main {
14061376
}
14071377
}
14081378

1409-
#caseStudies body > #deprecation-warning > .deprecation-warning, body.cid-casestudies > #deprecation-warning > .deprecation-warning {
1410-
color: inherit;
1411-
background: inherit;
1412-
width: 80%;
1413-
margin: 0;
1414-
margin-top: 120px;
1415-
margin-left: auto;
1416-
margin-right: auto;
1417-
border-radius: initial;
1418-
}
1419-
#deprecation-warning > .deprecation-warning a {
1420-
background: transparent;
1421-
color: inherit;
1422-
text-decoration: underline;
1423-
}
1424-
14251379
// search & sidebar
14261380
.td-sidebar {
14271381
@media only screen and (min-width: 768px) {

assets/scss/_k8s_community.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
body.community .k8s-deprecation-warning {
2+
background-color: $primary;
3+
color: white;
4+
margin: 0;
5+
}

assets/scss/_styles_project.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Add styles or import other files. */
77
@import "custom";
88

99
// Base styles
10+
@import "k8s_community";
1011
@import "k8s_nav";
1112

1213
//Media queries

hugo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ latest = "v1.32"
137137
version = "v1.32"
138138
githubbranch = "main"
139139
docsbranch = "main"
140+
# Should be changed to Docsy provided `archived_version` in the future.
140141
deprecated = false
141-
currentUrl = "https://kubernetes.io/docs/home/"
142+
url_latest_version = "https://kubernetes.io/docs/home/"
142143
nextUrl = "https://kubernetes-io-vnext-staging.netlify.com/"
143144

144145
# See code_sample shortcode

layouts/_default/baseof.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ <h1>{{ block "hero-title" . }}{{ .Params.bigheader | default .Title }}{{ end }}<
3131
<main role="main" class="td-main" {{ if (or (ne .FirstSection "case-studies") (not .IsSection) ) }}data-pagefind-body{{ end }}>
3232
{{ block "deprecation_warning" . }}
3333
{{ if or .IsHome ( eq .Params.cid "partners" ) ( eq .Params.cid "community" ) }}
34-
{{ partial "deprecation-warning.html" . }}
34+
{{ partial "version-banner.html" . }}
3535
{{ end }}
3636
{{ end }}
3737
{{ block "main" . }}{{ end }}

layouts/blog/baseof.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
</a>
3939
{{ end -}}
4040
{{ block "deprecation_warning" . }}
41-
{{ partial "deprecation-warning.html" . }}
41+
{{ partial "version-banner.html" . }}
4242
{{ end }}
4343
{{ block "main" . }}{{ end }}
4444
</main>

layouts/docs/baseof.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<main role="main" class="col-xl-8" {{ if ne .Params.cid "docsHome" }}data-pagefind-body{{ end }}{{ if (and .IsPage .Params.description ) }} data-pagefind-meta="description:{{ .Params.description }}"{{ end }}>
2626
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }}
2727
{{ block "deprecation_warning" . }}
28-
{{ partial "deprecation-warning.html" . }}
28+
{{ partial "version-banner.html" . }}
2929
{{ end }}
3030
{{ block "outdated_content" . }}
3131
{{ partial "docs/outdated_content.html" . }}

layouts/partials/deprecation-warning.html

Lines changed: 0 additions & 18 deletions
This file was deleted.

layouts/partials/version-banner.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{{ $color := "primary" }}
2+
<!-- Check the variable that indicates whether this is an archived doc set.
3+
If yes, display a banner. -->
4+
{{ if .Site.Params.deprecated }} {{/* Change the `deprecated` param to Docsy provided `archived_version` param once all use of this param is updated */}}
5+
{{ $latest_version := .Site.Params.url_latest_version }}
6+
{{ $current_version := .Site.Params.version }}
7+
<div class="pageinfo pageinfo-{{ $color }} k8s-deprecation-warning">
8+
{{ with $current_version }}
9+
<h3>
10+
{{ T "deprecation_title" }} {{ . | markdownify }}
11+
</h3>
12+
<p>Kubernetes {{ . | markdownify }} {{ T "deprecation_warning" }}
13+
<a href="{{ $latest_version | safeURL }}" target="_blank">{{ T "latest_version" }}</a></p>
14+
{{ end }}
15+
</div>
16+
{{ else if and (eq .Section "blog") (not .Params.evergreen) .Date (.Date.Before (now.AddDate -1 0 0)) -}}
17+
<div class="pageinfo pageinfo-{{ $color }}">
18+
<p>{{ T "outdated_blog__message" }}</p>
19+
</div>
20+
{{ end }}

0 commit comments

Comments
 (0)