Add support to build archive.istio.io's landing page. (#4036)

This commit is contained in:
Martin Taillefer 2019-04-24 16:07:51 -07:00 committed by GitHub
parent 2cd65eecd3
commit 8d5c03b060
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 105 additions and 74 deletions

View File

@ -12,8 +12,10 @@ copyright_year: 2019
# when preliminary=false and archive=false, we're building for istio.io
# When preliminary=true, we're building for preliminary.istio.io
# when archive=true, we're building for archive.istio.io
# when archive_landing=true, we're building the landing page for archive.istio.io
preliminary: true
archive: false
archive_landing: false
# When archive=true above, these values must be filled in
archive_date: YYYY-MM-DD

View File

@ -48,7 +48,9 @@
{{ end }}
{{ $analytics_id := .Site.Data.args.main_analytics_id }}
{{ if .Site.Data.args.archive }}
{{ if .Site.Data.args.archive_landing }}
<title>istio.io Archives</title>
{{ else if .Site.Data.args.archive }}
{{ if eq .Title "Istio" }}
<title>Istioldie {{ .Site.Data.args.version }}</title>
{{ else }}
@ -106,7 +108,7 @@
</head>
{{ $site_mode := ""}}
{{ if .Site.Data.args.archive }}
{{ if or .Site.Data.args.archive .Site.Data.args.archive_landing }}
{{ $site_mode = "archive-site" }}
{{ else if .Site.Data.args.preliminary }}
{{ $site_mode = "preliminary-site" }}

View File

@ -1,25 +1,42 @@
{{ define "main" }}
<script>
document.addEventListener("DOMContentLoaded", function() {
document.getElementById('panel1').style.opacity = "1";
{{ if .Site.Data.args.archive_landing }}
<main class="primary notoc">
<div id="sidebar-container" class="sidebar-container sidebar-offcanvas"></div>
<div class="article-container">
window.setTimeout(function() {
document.getElementById('panel2').style.opacity = "1";
}, 375);
<h1>istio.io Archives</h1>
<p>Snapshots of the <a href="https://istio.io">istio.io</a> website for each release.</p>
window.setTimeout(function() {
document.getElementById('panel3').style.opacity = "1";
}, 750);
<ul>
{{ range $archive := .Site.Data.archives }}
<li><a href="./{{ $archive.name }}">{{ $archive.name }}</a></li>
{{ end }}
</ul>
</div>
</main>
{{ else }}
<script>
document.addEventListener("DOMContentLoaded", function() {
document.getElementById('panel1').style.opacity = "1";
window.setTimeout(function() {
document.getElementById('panel4').style.opacity = "1";
}, 1125);
window.setTimeout(function() {
document.getElementById('panel2').style.opacity = "1";
}, 375);
window.setTimeout(function() {
document.getElementById('buttons').style.opacity = "1";
}, 1500);
});
</script>
window.setTimeout(function() {
document.getElementById('panel3').style.opacity = "1";
}, 750);
{{ .Content }}
window.setTimeout(function() {
document.getElementById('panel4').style.opacity = "1";
}, 1125);
window.setTimeout(function() {
document.getElementById('buttons').style.opacity = "1";
}, 1500);
});
</script>
{{ .Content }}
{{ end }}
{{ end }}

View File

@ -39,15 +39,21 @@
{{ printf "%s" $advisory }}<br>
{{ end }}
{{ if .Site.Data.args.archive }}
{{ i18n "footer_istio_archive" }}
{{ else if .Site.Data.args.preliminary }}
{{ i18n "footer_istio_preliminary" }}
{{ if .Site.Data.args.archive_landing }}
istio.io Archives
{{ else }}
{{ i18n "footer_istio" }}
{{ end }}
{{ if .Site.Data.args.archive }}
{{ i18n "footer_istio_archive" }}
{{ else if .Site.Data.args.preliminary }}
{{ i18n "footer_istio_preliminary" }}
{{ else }}
{{ i18n "footer_istio" }}
{{ end }}
{{ strings.TrimSuffix ".0" .Site.Data.args.full_version }}
{{ end -}}
<br>&copy; {{ .Site.Data.args.copyright_year }} Istio Authors, <a href="https://policies.google.com/privacy">{{ i18n "footer_privacy_policy" }}</a><br>
{{ strings.TrimSuffix ".0" .Site.Data.args.full_version }}<br>&copy; {{ .Site.Data.args.copyright_year }} Istio Authors, <a href="https://policies.google.com/privacy">{{ i18n "footer_privacy_policy" }}</a><br>
{{ if .Site.Data.args.archive }}
{{ printf (i18n "footer_archived_on") (dateFormat (i18n "footer_date_format") .Site.Data.args.archive_date) }}
{{ else }}

View File

@ -9,7 +9,9 @@
<a id="brand" href="{{ $home.Permalink }}">
<span class="logo">{{ with resources.Get "inline_images/istio-whitelogo-bluebackground-rounded.svg" }}{{ ( . | minify).Content | safeHTML }}{{ end }}</span>
{{ if .Site.Data.args.archive }}
{{ if .Site.Data.args.archive_landing }}
<span class="name">Istioldies</span>
{{ else if .Site.Data.args.archive }}
<span class="name">Istioldie {{ .Site.Data.args.version }}</span>
{{ else if .Site.Data.args.preliminary }}
<span class="name">Istio Prelim {{ .Site.Data.args.version }}</span>
@ -52,63 +54,65 @@
{{ end }}
{{ end }}
<div class="menu">
<button id="gearDropdownButton" class="menu-trigger" title='{{ i18n "options_menu" }}'
aria-label="Options and Settings" aria-controls="gearDropdownContent">
{{ partial "icon.html" "gear" }}
</button>
{{ if not .Site.Data.args.archive_landing }}
<div class="menu">
<button id="gearDropdownButton" class="menu-trigger" title='{{ i18n "options_menu" }}'
aria-label="Options and Settings" aria-controls="gearDropdownContent">
{{ partial "icon.html" "gear" }}
</button>
<div id="gearDropdownContent" class="menu-content" aria-labelledby="gearDropdownButton" role="menu">
<a tabindex="-1" role="menuitem" lang="en" id="switch-lang-en" {{ if eq $home.Lang "en" }}class="active"{{ end }}>English</a>
<a tabindex="-1" role="menuitem" lang="zh" id="switch-lang-zh" {{ if eq $home.Lang "zh" }}class="active"{{ end }}>中文</a>
<div id="gearDropdownContent" class="menu-content" aria-labelledby="gearDropdownButton" role="menu">
<a tabindex="-1" role="menuitem" lang="en" id="switch-lang-en" {{ if eq $home.Lang "en" }}class="active"{{ end }}>English</a>
<a tabindex="-1" role="menuitem" lang="zh" id="switch-lang-zh" {{ if eq $home.Lang "zh" }}class="active"{{ end }}>中文</a>
<div role="separator"></div>
<a tabindex="-1" role="menuitem" class="active" id="light-theme-item">{{ i18n "light_theme" }}</a>
<a tabindex="-1" role="menuitem" id="dark-theme-item">{{ i18n "dark_theme" }}</a>
<div role="separator"></div>
<a tabindex="-1" role="menuitem" id="syntax-coloring-item">{{ i18n "syntax_coloring" }}</a>
{{ if not .Site.Data.args.archive }}
<div role="separator"></div>
{{ if .Params.source_repo }}
{{ $msg := i18n "generated_file" }}
{{ $title := printf $msg .Page.Params.source_repo }}
<a tabindex="-1" role="menuitem" class="disabled" title="{{ $title }}">{{ i18n "edit_on_github" }}</a>
{{ else }}
{{ if eq $home.Lang "zh" }}
<a tabindex="-1" role="menuitem" href="https://github.com/istio/istio.io/edit/{{ .Site.Data.args.doc_branch_name }}/content_zh/{{ .Path }}">{{ i18n "edit_on_github" }}</a>
<a tabindex="-1" role="menuitem" class="active" id="light-theme-item">{{ i18n "light_theme" }}</a>
<a tabindex="-1" role="menuitem" id="dark-theme-item">{{ i18n "dark_theme" }}</a>
<div role="separator"></div>
<a tabindex="-1" role="menuitem" id="syntax-coloring-item">{{ i18n "syntax_coloring" }}</a>
{{ if not .Site.Data.args.archive }}
<div role="separator"></div>
{{ if .Params.source_repo }}
{{ $msg := i18n "generated_file" }}
{{ $title := printf $msg .Page.Params.source_repo }}
<a tabindex="-1" role="menuitem" class="disabled" title="{{ $title }}">{{ i18n "edit_on_github" }}</a>
{{ else }}
<a tabindex="-1" role="menuitem" href="https://github.com/istio/istio.io/edit/{{ .Site.Data.args.doc_branch_name }}/content/{{ .Path }}">{{ i18n "edit_on_github" }}</a>
{{ if eq $home.Lang "zh" }}
<a tabindex="-1" role="menuitem" href="https://github.com/istio/istio.io/edit/{{ .Site.Data.args.doc_branch_name }}/content_zh/{{ .Path }}">{{ i18n "edit_on_github" }}</a>
{{ else }}
<a tabindex="-1" role="menuitem" href="https://github.com/istio/istio.io/edit/{{ .Site.Data.args.doc_branch_name }}/content/{{ .Path }}">{{ i18n "edit_on_github" }}</a>
{{ end }}
{{ end }}
<a tabindex="-1" role="menuitem" href="https://github.com/istio/istio.io/issues/new?title=Issue%20with%20{{ .Path}}">{{ i18n "report_site_bugs" }}</a>
{{ end }}
<a tabindex="-1" role="menuitem" href="https://github.com/istio/istio.io/issues/new?title=Issue%20with%20{{ .Path}}">{{ i18n "report_site_bugs" }}</a>
{{ end }}
<div role="separator"></div>
<div role="separator"></div>
<h6>{{ i18n "other_versions_of_site" }}</h6>
<h6>{{ i18n "other_versions_of_site" }}</h6>
{{ $next := .Site.Data.versions.preliminary }}
{{ $current := .Site.Data.versions.main }}
{{ $next := .Site.Data.versions.preliminary }}
{{ $current := .Site.Data.versions.main }}
{{ if .Site.Data.args.archive }}
<a tabindex="-1" role="menuitem" onclick="navigateToUrlOrRoot('https://istio.io/{{.Dir}}');return false;">{{ printf (i18n "current_release") $current }}</a>
<a tabindex="-1" role="menuitem" onclick="navigateToUrlOrRoot('https://preliminary.istio.io/{{.Dir}}');return false;">{{ printf (i18n "next_release") $next }}</a>
<a tabindex="-1" role="menuitem" href="https://archive.istio.io">{{ i18n "archived_releases" }}</a>
{{ else if .Site.Data.args.preliminary }}
<a tabindex="-1" role="menuitem" onclick="navigateToUrlOrRoot('https://istio.io/{{.Dir}}');return false;">{{ printf (i18n "current_release") $current }}</a>
<a tabindex="-1" role="menuitem" href="https://archive.istio.io">{{ i18n "archived_releases" }}</a>
{{ else }}
<a tabindex="-1" role="menuitem" onclick="navigateToUrlOrRoot('https://preliminary.istio.io/{{.Dir}}');return false;">{{ printf (i18n "next_release") $next }}</a>
<a tabindex="-1" role="menuitem" href="https://archive.istio.io">{{ i18n "archived_releases" }}</a>
{{ end }}
{{ if .Site.Data.args.archive }}
<a tabindex="-1" role="menuitem" onclick="navigateToUrlOrRoot('https://istio.io/{{.Dir}}');return false;">{{ printf (i18n "current_release") $current }}</a>
<a tabindex="-1" role="menuitem" onclick="navigateToUrlOrRoot('https://preliminary.istio.io/{{.Dir}}');return false;">{{ printf (i18n "next_release") $next }}</a>
<a tabindex="-1" role="menuitem" href="https://archive.istio.io">{{ i18n "archived_releases" }}</a>
{{ else if .Site.Data.args.preliminary }}
<a tabindex="-1" role="menuitem" onclick="navigateToUrlOrRoot('https://istio.io/{{.Dir}}');return false;">{{ printf (i18n "current_release") $current }}</a>
<a tabindex="-1" role="menuitem" href="https://archive.istio.io">{{ i18n "archived_releases" }}</a>
{{ else }}
<a tabindex="-1" role="menuitem" onclick="navigateToUrlOrRoot('https://preliminary.istio.io/{{.Dir}}');return false;">{{ printf (i18n "next_release") $next }}</a>
<a tabindex="-1" role="menuitem" href="https://archive.istio.io">{{ i18n "archived_releases" }}</a>
{{ end }}
</div>
</div>
</div>
{{ end }}
<button id="search-show" title='{{ i18n "search" }}' aria-label='{{ i18n "search_label" }}'>{{ partial "icon.html" "magnifier" }}</button>
</div>
@ -116,7 +120,7 @@
<form id="search-form" name="cse" role="search">
{{ if .Site.Data.args.preliminary }}
<input type="hidden" name="cx" value="{{ .Site.Data.args.preliminary_search_engine_id }}" />
{{ else if .Site.Data.args.archive }}
{{ else if or .Site.Data.args.archive .Site.Data.args.archive_landing }}
<input type="hidden" name="cx" value="{{ .Site.Data.args.archive_search_engine_id }}" />
{{ else }}
<input type="hidden" name="cx" value="{{ .Site.Data.args.main_search_engine_id }}" />