feat: replaced the deprecation-warning partial with docsy provided version-banner and customising it

pull/50217/head
Sayak Mukhopadhyay 2025-03-24 22:49:59 +05:30
parent 025268bada
commit 804388f903
No known key found for this signature in database
GPG Key ID: 89EEFF3FB23D3FFD
9 changed files with 31 additions and 68 deletions

View File

@ -1137,26 +1137,6 @@ body.cid-community #cncf-code-of-conduct h2:after {
} }
} }
body.cid-casestudies, body.cid-community, body.cid-partners {
section#deprecation-warning {
padding: 0;
margin: 0;
width: 100%;
border-top: solid 1em $primary;
border-bottom: solid 1em $primary;
// Center the pageinfo
padding-left: calc(max(1rem, (100vw - 60rem) / 2));
padding-right: calc(max(1rem, (100vw - 60rem) / 2));
}
/* Ensure color overrides */
section#deprecation-warning, section#deprecation-warning > .pageinfo.deprecation-warning {
background-color: $primary;
color: #fff;
}
}
body.cid-partners { body.cid-partners {
/* SECTIONS */ /* SECTIONS */
.section { .section {
@ -1357,16 +1337,6 @@ body.cid-partners {
} }
} }
} }
body.cid-community > #deprecation-warning > .deprecation-warning {
margin-left: 20px;
margin-right: 20px;
color: #faf5b6;
background-color: inherit;
}
body.cid-community > #deprecation-warning > .deprecation-warning > * {
color: inherit;
background-color: inherit;
}
body.cid-code-of-conduct main { body.cid-code-of-conduct main {
max-width: calc(min(90vw, 100em)); max-width: calc(min(90vw, 100em));
@ -1406,22 +1376,6 @@ body.cid-code-of-conduct main {
} }
} }
#caseStudies body > #deprecation-warning > .deprecation-warning, body.cid-casestudies > #deprecation-warning > .deprecation-warning {
color: inherit;
background: inherit;
width: 80%;
margin: 0;
margin-top: 120px;
margin-left: auto;
margin-right: auto;
border-radius: initial;
}
#deprecation-warning > .deprecation-warning a {
background: transparent;
color: inherit;
text-decoration: underline;
}
// search & sidebar // search & sidebar
.td-sidebar { .td-sidebar {
@media only screen and (min-width: 768px) { @media only screen and (min-width: 768px) {

View File

@ -0,0 +1,5 @@
body.community .k8s-deprecation-warning {
background-color: $primary;
color: white;
margin: 0;
}

View File

@ -7,6 +7,7 @@ Add styles or import other files. */
@import "custom"; @import "custom";
// Base styles // Base styles
@import "k8s_community";
@import "k8s_nav"; @import "k8s_nav";
//Media queries //Media queries

View File

@ -137,8 +137,9 @@ latest = "v1.32"
version = "v1.32" version = "v1.32"
githubbranch = "main" githubbranch = "main"
docsbranch = "main" docsbranch = "main"
# Should be changed to Docsy provided `archived_version` in the future.
deprecated = false deprecated = false
currentUrl = "https://kubernetes.io/docs/home/" url_latest_version = "https://kubernetes.io/docs/home/"
nextUrl = "https://kubernetes-io-vnext-staging.netlify.com/" nextUrl = "https://kubernetes-io-vnext-staging.netlify.com/"
# See code_sample shortcode # See code_sample shortcode

View File

@ -31,7 +31,7 @@
<main role="main" class="td-main" {{ if (or (ne .FirstSection "case-studies") (not .IsSection) ) }}data-pagefind-body{{ end }}> <main role="main" class="td-main" {{ if (or (ne .FirstSection "case-studies") (not .IsSection) ) }}data-pagefind-body{{ end }}>
{{ block "deprecation_warning" . }} {{ block "deprecation_warning" . }}
{{ if or .IsHome ( eq .Params.cid "partners" ) ( eq .Params.cid "community" ) }} {{ if or .IsHome ( eq .Params.cid "partners" ) ( eq .Params.cid "community" ) }}
{{ partial "deprecation-warning.html" . }} {{ partial "version-banner.html" . }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ block "main" . }}{{ end }} {{ block "main" . }}{{ end }}

View File

@ -38,7 +38,7 @@
</a> </a>
{{ end -}} {{ end -}}
{{ block "deprecation_warning" . }} {{ block "deprecation_warning" . }}
{{ partial "deprecation-warning.html" . }} {{ partial "version-banner.html" . }}
{{ end }} {{ end }}
{{ block "main" . }}{{ end }} {{ block "main" . }}{{ end }}
</main> </main>

View File

@ -25,7 +25,7 @@
<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 }}> <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 }}>
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }} {{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }}
{{ block "deprecation_warning" . }} {{ block "deprecation_warning" . }}
{{ partial "deprecation-warning.html" . }} {{ partial "version-banner.html" . }}
{{ end }} {{ end }}
{{ block "outdated_content" . }} {{ block "outdated_content" . }}
{{ partial "docs/outdated_content.html" . }} {{ partial "docs/outdated_content.html" . }}

View File

@ -1,18 +0,0 @@
{{ if (.Site.Param "deprecated") }}
<section id="deprecation-warning">
<div class="deprecation-warning {{ if $.IsHome }}home-pageinfo{{else}}pageinfo{{ end }}">
<h3>
{{ T "deprecation_title" }} {{ .Param "version" }}
</h3>
<p> Kubernetes {{ .Param "version" }} {{ T "deprecation_warning" }}
<a href="{{ site.Params.currentUrl }}">{{ T "latest_version" }}</a>
</p>
</div>
</section>
{{ else if and (eq .Section "blog") (not .Params.evergreen) .Date (.Date.Before (now.AddDate -1 0 0)) -}}
<section id="deprecation-warning">
<div class="deprecation-warning pageinfo outdated-blog">
<p>{{ T "outdated_blog__message" }}</p>
</div>
</section>
{{ end }}

View File

@ -0,0 +1,20 @@
{{ $color := "primary" }}
<!-- Check the variable that indicates whether this is an archived doc set.
If yes, display a banner. -->
{{ if .Site.Params.deprecated }} {{/* Change the `deprecated` param to Docsy provided `archived_version` param once all use of this param is updated */}}
{{ $latest_version := .Site.Params.url_latest_version }}
{{ $current_version := .Site.Params.version }}
<div class="pageinfo pageinfo-{{ $color }} k8s-deprecation-warning">
{{ with $current_version }}
<h3>
{{ T "deprecation_title" }} {{ . | markdownify }}
</h3>
<p>Kubernetes {{ . | markdownify }} {{ T "deprecation_warning" }}
<a href="{{ $latest_version | safeURL }}" target="_blank">{{ T "latest_version" }}</a></p>
{{ end }}
</div>
{{ else if and (eq .Section "blog") (not .Params.evergreen) .Date (.Date.Before (now.AddDate -1 0 0)) -}}
<div class="pageinfo pageinfo-{{ $color }}">
<p>{{ T "outdated_blog__message" }}</p>
</div>
{{ end }}