Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,26 @@
{{ $currentPage := .}}
{{ range .Site.Menus.main }}
{{ $active := or (eq $currentPage.Title .Name) (or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .)) }}
{{ if .HasChildren }}
{{ if and (eq .Identifier "docs") (eq $.Section "docs") (eq hugo.Environment "production") }}
<li class="main-navigation-links-item">
<a href="{{ .URL | relLangURL }}" class="main-navigation-links-link has-dropdown {{ if $active }}active{{ end }}">
<span>{{ .Name }}</span>
{{ partial "icon.html" "dropdown-arrow" }}
</a>

<ul class="main-navigation-links-dropdown">
{{ range .Children }}
<li class="main-navigation-links-dropdown-item">
<a href="{{ .URL | relLangURL }}" class="main-navigation-links-link">{{ .Name }}</a>
</li>
{{ end }}


{{ partial "version-selector.html" $ }}

</ul>
</li>
{{else if .HasChildren }}
<li class="main-navigation-links-item">
<a {{ if ne .URL "" }}href="{{ .URL | relLangURL }}"{{end}} class="main-navigation-links-link has-dropdown {{ if $active }}active{{ end }}">
<span>{{ .Name }}</span>
Expand All @@ -48,11 +67,12 @@
{{ end }}
</ul>



<div class="main-navigation-footer">
<button id="search-show" class="search-show" title='{{ i18n "search" }}' aria-label='{{ i18n "search_label" }}'>{{ partial "icon.html" "magnifier" }}</button>
<a href='{{ "/docs/overview/quickstart" | relLangURL }}' class="btn btn--primary" id="try-istio">{{ i18n "try_istio" }}</a>
</div>

</div>

<form id="search-form" class="search" name="cse" role="search">
Expand All @@ -69,5 +89,7 @@
<input id="search-textbox" class="search-textbox form-control" name="q" type="search" aria-label='{{ i18n "search" }}' placeholder='{{ i18n "search_label" }}' />
<button id="search-close" title='{{ i18n "search_cancel" }}' type="reset" aria-label='{{ i18n "search_cancel" }}'>{{ partial "icon.html" "menu-close" }}</button>
</form>


</nav>
</header>
42 changes: 42 additions & 0 deletions layouts/partials/version-selector.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{ if and (eq .Section "docs") (eq hugo.Environment "production") }}
{{ $versions := site.Data.versions }}
{{ $mainVerStr := $versions.main }}
{{ $preliminaryVerStr := $versions.preliminary }}
{{ $mainVerParts := split $mainVerStr "." }}
{{ $major := index $mainVerParts 0 | int }}
{{ $minor := index $mainVerParts 1 | int }}
{{ $versionCount := 5 }}

<!-- Preliminary version -->
{{ $preUrl := printf "https://preliminary.istio.io/v%s/docs" $preliminaryVerStr }}
<li class="main-navigation-links-dropdown-item">
<a href="{{ $preUrl }}"
class="main-navigation-links-link {{ if in $.Permalink "/preliminary/" }}active{{ end }}">
Preliminary
</a>
</li>

<!-- Main version -->
{{ $mainUrl := printf "https://istio.io/v%s/docs" $mainVerStr }}
<li class="main-navigation-links-dropdown-item">
<a href="{{ $mainUrl }}"
class="main-navigation-links-link {{ if in $.Permalink (print "/v" $mainVerStr "/") }}active{{ end }}">
<strong>v{{ $mainVerStr }} (Current)</strong>
</a>
</li>

<!-- Previous versions -->
{{ range $i := seq 1 (sub $versionCount 1) }}
{{ $currentMinor := sub $minor $i }}
{{ if ge $currentMinor 0 }}
{{ $ver := printf "v%d.%d" $major $currentMinor }}
{{ $url := printf "https://istio.io/%s/docs" $ver }}
<li class="main-navigation-links-dropdown-item">
<a href="{{ $url }}"
class="main-navigation-links-link {{ if in $.Permalink (print "/" $ver "/") }}active{{ end }}">
{{ $ver }}
</a>
</li>
{{ end }}
{{ end }}
{{ end }}
2 changes: 2 additions & 0 deletions scripts/archive_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ NUMBER=$(grep -w 'version:' data/args.yml | grep -oE '[^ ]+$' | tr -d '"')
VERSION+="${NUMBER}"

rm -rf public/
#set the Hugo environment to development for preventing production code in local builds
export HUGO_ENVIRONMENT=development
./scripts/gen_site.sh
./scripts/build_site.sh /"${VERSION}"

Expand Down