From 4fa23bc60451d609f10ba2e1d79a34af5be5d904 Mon Sep 17 00:00:00 2001 From: morix1500 Date: Tue, 4 Jul 2023 19:43:37 +0900 Subject: [PATCH] Provide a per-page outdated notification for localized content --- data/i18n/en/en.toml | 6 ++++++ layouts/docs/baseof.html | 3 +++ layouts/partials/docs/outdated_content.html | 22 +++++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 layouts/partials/docs/outdated_content.html diff --git a/data/i18n/en/en.toml b/data/i18n/en/en.toml index 149e0204a1..6508023082 100644 --- a/data/i18n/en/en.toml +++ b/data/i18n/en/en.toml @@ -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 Dockershim Removal FAQ for further details.""" diff --git a/layouts/docs/baseof.html b/layouts/docs/baseof.html index 2c056ac467..a3a8e8e677 100644 --- a/layouts/docs/baseof.html +++ b/layouts/docs/baseof.html @@ -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" -}} diff --git a/layouts/partials/docs/outdated_content.html b/layouts/partials/docs/outdated_content.html new file mode 100644 index 0000000000..df5d5fe5e4 --- /dev/null +++ b/layouts/partials/docs/outdated_content.html @@ -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 }} +
+

{{ T "outdated_content_title" }}

+

{{ T "outdated_content_message" }} {{ $originPageTitle }}

+
+ {{ end }} + {{ end }} +{{ end }}