Provide a per-page outdated notification for localized content

pull/41768/head
morix1500 2023-07-04 19:43:37 +09:00
parent b16f8db668
commit 4fa23bc604
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 }}