Merge pull request #41768 from morix1500/outdated_content_caution

Provide a per-page outdated notification for localized content
pull/42040/head
Kubernetes Prow Robot 2023-07-16 16:01:06 -07:00 committed by GitHub
commit 89c87e47eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 0 deletions

View File

@ -70,6 +70,12 @@ other = " documentation is no longer actively maintained. The version you are cu
[deprecation_file_warning]
other = "Deprecated"
[outdated_content_title]
other = "Information in this document may be out of date"
[outdated_content_message]
other = "This document has an older update date than the original, so the information it contains may be out of date. If you're able to read English, see the English version for the most up-to-date information: "
[dockershim_message]
other = """Dockershim has been removed from the Kubernetes project as of release 1.24. Read the <a href="/dockershim">Dockershim Removal FAQ</a> for further details."""

View File

@ -24,6 +24,9 @@
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }}
{{ block "deprecated" . }}
{{ partial "deprecation-warning.html" . }}
{{ end }}
{{ block "outdated_content" . }}
{{ partial "docs/outdated_content.html" . }}
{{ end }}
{{ block "main" . }}{{ end }}
{{- if .HasShortcode "thirdparty-content" -}}

View File

@ -0,0 +1,22 @@
{{ if not (.Site.Param "deprecated") }}
{{ if ne .Site.Language.Lang "en" }}
{{ $currentLastmodUnixtime := .Lastmod.Unix }}
{{ $originCurrentLastmodUnixtime := 0 }}
{{ $originPageURL := "" }}
{{ $originPageTitle := "" }}
{{ range .Translations }}
{{ if eq .Lang "en" }}
{{ $originCurrentLastmodUnixtime = .Lastmod.Unix }}
{{ $originPageURL = .RelPermalink }}
{{ $originPageTitle = .Title }}
{{ break }}
{{ end }}
{{ end }}
{{ if lt $currentLastmodUnixtime $originCurrentLastmodUnixtime }}
<div class="pageinfo pageinfo-primary outdated-localization-notice">
<p><strong>{{ T "outdated_content_title" }}</strong></p>
<p><span class="outdated-localization-notice-text">{{ T "outdated_content_message" }} <a href="{{ $originPageURL }}">{{ $originPageTitle }}</a></span></p>
</div>
{{ end }}
{{ end }}
{{ end }}