Skip to content

Commit 4fa23bc

Browse files
committed
Provide a per-page outdated notification for localized content
1 parent b16f8db commit 4fa23bc

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

data/i18n/en/en.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ other = " documentation is no longer actively maintained. The version you are cu
7070
[deprecation_file_warning]
7171
other = "Deprecated"
7272

73+
[outdated_content_title]
74+
other = "Information in this document may be out of date"
75+
76+
[outdated_content_message]
77+
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: "
78+
7379
[dockershim_message]
7480
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."""
7581

layouts/docs/baseof.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }}
2525
{{ block "deprecated" . }}
2626
{{ partial "deprecation-warning.html" . }}
27+
{{ end }}
28+
{{ block "outdated_content" . }}
29+
{{ partial "docs/outdated_content.html" . }}
2730
{{ end }}
2831
{{ block "main" . }}{{ end }}
2932
{{- if .HasShortcode "thirdparty-content" -}}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{ if not (.Site.Param "deprecated") }}
2+
{{ if ne .Site.Language.Lang "en" }}
3+
{{ $currentLastmodUnixtime := .Lastmod.Unix }}
4+
{{ $originCurrentLastmodUnixtime := 0 }}
5+
{{ $originPageURL := "" }}
6+
{{ $originPageTitle := "" }}
7+
{{ range .Translations }}
8+
{{ if eq .Lang "en" }}
9+
{{ $originCurrentLastmodUnixtime = .Lastmod.Unix }}
10+
{{ $originPageURL = .RelPermalink }}
11+
{{ $originPageTitle = .Title }}
12+
{{ break }}
13+
{{ end }}
14+
{{ end }}
15+
{{ if lt $currentLastmodUnixtime $originCurrentLastmodUnixtime }}
16+
<div class="pageinfo pageinfo-primary outdated-localization-notice">
17+
<p><strong>{{ T "outdated_content_title" }}</strong></p>
18+
<p><span class="outdated-localization-notice-text">{{ T "outdated_content_message" }} <a href="{{ $originPageURL }}">{{ $originPageTitle }}</a></span></p>
19+
</div>
20+
{{ end }}
21+
{{ end }}
22+
{{ end }}

0 commit comments

Comments
 (0)