|
1 | 1 | {{ $pageProseLang := partial "i18n/lang.html" . -}}
|
2 | 2 | {{ $siteLang := .Site.Language -}}
|
3 | 3 |
|
4 |
| -{{/* |
| 4 | +{{ if ne .Language.Lang "en" -}} |
| 5 | + {{ if .Params.drifted_from_default -}} |
| 6 | + {{ with partial "_inline/ot-page-drifted-banner.html" . -}} |
| 7 | + {{ . -}} |
| 8 | + {{ end -}} |
| 9 | + {{ else if ne $siteLang $pageProseLang -}} |
| 10 | + {{ with partial "_inline/ot-page-not-found-banner.html" . -}} |
| 11 | + <div class="pageinfo pageinfo-secondary"> |
| 12 | + <div class="ps-4"> |
| 13 | + {{ . }} |
| 14 | + </div> |
| 15 | + </div> |
| 16 | + {{ end -}} |
| 17 | + {{ else if false -}} |
| 18 | + {{ with partial "_inline/ot-page-drifted-banner.html" . -}} |
| 19 | + {{ . -}} |
| 20 | + {{ end -}} |
| 21 | + {{ end -}} |
| 22 | +{{ end -}} |
5 | 23 |
|
6 |
| -The disable_translation_not_found_msg param isn't currently used and I suspect |
7 |
| -that we won't need it, but I'll wait until the following feature is implemented |
8 |
| -before removing the code: |
9 | 24 |
|
10 |
| -https://github.com/open-telemetry/opentelemetry.io/issues/6340 |
| 25 | +{{ define "partials/_inline/ot-page-drifted-banner.html" }} |
| 26 | + {{/* Assumption: .Params.drifted_from_default */ -}} |
11 | 27 |
|
12 |
| -*/ -}} |
| 28 | + {{ $resultsArray := where .Translations "Lang" "en" -}} |
| 29 | + {{ $defaultLangPage := index $resultsArray 0 -}} |
13 | 30 |
|
14 |
| -{{ if and |
15 |
| - (ne $siteLang $pageProseLang) |
16 |
| - (not (.Param "disable_translation_not_found_msg")) |
17 |
| --}} |
18 |
| - {{ with partial "_inline/ot-page-not-found-banner.html" . -}} |
19 | 31 | <div class="pageinfo pageinfo-secondary">
|
20 | 32 | <div class="ps-4">
|
21 |
| - {{ . }} |
| 33 | + <p> |
| 34 | + <i class="fa-solid fa-triangle-exclamation" style="margin-left: -1.9rem; padding-right: 0.5rem;"></i> |
| 35 | + The content of this page may be <b>outdated</b> and some links may be invalid. |
| 36 | + |
| 37 | + {{- if and $defaultLangPage .Params.default_lang_commit }} |
| 38 | + A <strong>newer version</strong> of this page exists in |
| 39 | + <a href="{{ $defaultLangPage.RelPermalink }}">English</a>. |
| 40 | + <details class="mt-2"> |
| 41 | + <summary>More information ...</summary> |
| 42 | + <p> |
| 43 | + To see the changes to the English page since this page was last updated: visit |
| 44 | + {{ $compareUrl := printf "%s/compare/%s..%s" |
| 45 | + .Site.Params.github_repo .Params.default_lang_commit $defaultLangPage.GitInfo.Hash -}} |
| 46 | + <a href="{{ $compareUrl }}" class="external-link" target="_blank" rel="noopener"> |
| 47 | + GitHub compare |
| 48 | + {{ substr .Params.default_lang_commit 0 8 }}..{{ $defaultLangPage.GitInfo.AbbreviatedHash -}} |
| 49 | + </a> |
| 50 | + and search for |
| 51 | + {{ $defLangPath := strings.TrimPrefix (add hugo.WorkingDir "/") $defaultLangPage.File.Filename -}} |
| 52 | + <code>{{ $defLangPath }}</code>. |
| 53 | + </p> |
| 54 | + </details> |
| 55 | + {{ else if not $defaultLangPage }} |
| 56 | + This page no longer has a corresponding English page. |
| 57 | + {{ end -}} |
| 58 | + </p> |
22 | 59 | </div>
|
23 |
| - </div> |
24 |
| - {{ end -}} |
| 60 | +</div> |
25 | 61 | {{ end -}}
|
26 | 62 |
|
| 63 | + |
27 | 64 | {{ define "partials/_inline/ot-page-not-found-banner.html" }}
|
28 | 65 | {{ $path := "page-not-translated-msg.md" -}}
|
29 | 66 | {{ $args := (dict
|
|
37 | 74 | {{ warnf "_inline/ot-page-not-found-banner: '%s' not found from page %s (%s)" $path .Page.Path $lang -}}
|
38 | 75 | {{ end -}}
|
39 | 76 | {{ end -}}
|
40 |
| - |
|
0 commit comments