Skip to content

Commit 1d35576

Browse files
istio-testingsbegin0craigbox
authored
[release-1.24] feat: add Out-Of-Date Documentation header for archive versions (#16530)
* Added Deprecated Documentation Header Added a warning header to all docs pages warning user that this version is out-of-date with an option to go to /latest * Update banner with craig's comments * created _archive.scss and added archive check for banner * added i18n en for archive banner * added uk and zh for archive header * fix lint * test new linter to ignore /latest/ on archive sites * lint the linter * lint the linter with local testing first * lint the linter with local testing that I test, first --------- Co-authored-by: sbegin0 <[email protected]> Co-authored-by: sbegin0 <[email protected]> Co-authored-by: Craig Box <[email protected]>
1 parent 298f8c9 commit 1d35576

File tree

7 files changed

+61
-2
lines changed

7 files changed

+61
-2
lines changed

assets/sass/_all.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
@import "misc/about";
1313
@import "misc/analysis-message";
14+
@import "misc/archive";
1415
@import "misc/article";
1516
@import "misc/banners";
1617
@import "misc/blog";

assets/sass/misc/_archive.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.archive-warning-banner {
2+
background-color: #fff3cd;
3+
color: #664d03;
4+
padding: 1rem;
5+
border-bottom: 1px solid #ffecb5;
6+
text-align: center;
7+
8+
p {
9+
margin-top: 0;
10+
margin-bottom: 0;
11+
}
12+
13+
a {
14+
font-weight: bold;
15+
text-decoration: underline;
16+
color: #413002; // Making link slightly darker than banner text for better contrast/visibility
17+
}
18+
}

i18n/en.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,3 +385,9 @@ other = "Go to solutions"
385385

386386
[case_study_slogan]
387387
other = "Read case studies of companies that benefited from implementing Istio"
388+
389+
[archive_banner_text]
390+
other = "⚠️ This documentation is for an older version (<strong>%s</strong>) and is no longer updated."
391+
392+
[archive_banner_link]
393+
other = "Read the latest version."

i18n/uk.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,3 +377,9 @@ other = "Перейти до рішень"
377377

378378
[case_study_slogan]
379379
other = "Читайте приклади успішних прикладів використання Istio компаніями, які отримали вигоду від його впровадження"
380+
381+
[archive_banner_text]
382+
other = "⚠️ Це документація для (застарілої) версії (<strong>%s</strong>), яка вже не підтримується."
383+
384+
[archive_banner_link]
385+
other = "Читати останню версію."

i18n/zh.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,3 +375,9 @@ other = "转到解决方案"
375375

376376
[case_study_slogan]
377377
other = "阅读因实施 Istio 而受益的公司案例"
378+
379+
[archive_banner_text]
380+
other = "⚠️ 此文档针对过时的版本 (<strong>%s</strong>),将不在维护和更新。"
381+
382+
[archive_banner_link]
383+
other = "查看最新文档。"

layouts/_default/baseof.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,15 @@
156156

157157
{{ partial "events.html" (dict "page" . "kind" "sticker") }}
158158
{{ partial "header.html" . }}
159+
160+
<!-- Archived Documentation Header -->
161+
{{ if and (eq .Section "docs") .Site.Data.args.archive}}
162+
<div class="archive-warning-banner" role="alert">
163+
{{ (printf (i18n "archive_banner_text") .Site.Data.args.version) | safeHTML }}
164+
<a href="/latest{{ .RelPermalink | safeURL }}">{{ i18n "archive_banner_link" }}</a>
165+
</div>
166+
{{ end }}
167+
159168
{{ partial "events.html" (dict "page" . "kind" "banner") }}
160169

161170
{{ block "main" . }}{{ end }}

scripts/lint_site.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
set -e
1818

1919
FAILED=0
20+
ARCHIVE=0
21+
22+
# If the archive flag is set, we allow links to `/latest/` that won't exist
23+
# at the time of linting, but will exist when the archive is copied to the
24+
# current serving branch.
25+
if grep -q "^archive: true" data/args.yml 2>/dev/null; then
26+
ARCHIVE=1
27+
fi
2028

2129
if [[ "$#" -ne 0 ]]; then
2230
LANGS="$*"
@@ -204,13 +212,18 @@ if [ -d ./public ]; then
204212
printf -v ignore_files "/^.\/public\/%s/," "${SKIP_LANGS[@]}"; ignore_files="${ignore_files%,}"
205213
fi
206214
echo "Running linkinator..."
207-
if [[ ${CHECK_EXTERNAL_LINKS:-} == "true" ]]; then
215+
if [[ ${ARCHIVE:-} -eq 1 ]]; then
216+
echo "Linting archive"
217+
if ! linkinator public/ -r -s 'github.com localhost:3000 localhost:5601 localhost:8001 localhost:9080 localhost:9081 en.wikipedia.org my-istio-logs-database.io ^((?!localhost).)*$ /latest/' --silent --concurrency 25; then
218+
FAILED=1
219+
fi
220+
elif [[ ${CHECK_EXTERNAL_LINKS:-} == "true" ]]; then
208221
if ! linkinator public/ -r -s 'github.com localhost:3000 localhost:5601 localhost:8001 localhost:9080 localhost:9081 en.wikipedia.org my-istio-logs-database.io' --silent --concurrency 25; then
209222
FAILED=1
210223
fi
211224
else
212225
#TODO: Remove .../workload-selector/ from ignored links. PRs take a long time to get through istio/api, and a link is broken from there. Once this PR is complete, remove it: https://github.com/istio/api/pull/1405
213-
if ! linkinator public/ -r -s 'github.com localhost:3000 localhost:5601 localhost:8001 localhost:9080 localhost:9081 en.wikipedia.org my-istio-logs-database.io ^((?!localhost).)*$ /docs/reference/config/type/v1beta1/workload-selector/' --silent --concurrency 25; then
226+
if ! linkinator public/ -r -s 'github.com localhost:3000 localhost:5601 localhost:8001 localhost:9080 localhost:9081 en.wikipedia.org my-istio-logs-database.io ^((?!localhost).)*$' --silent --concurrency 25; then
214227
FAILED=1
215228
fi
216229
fi

0 commit comments

Comments
 (0)