Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version dropdown and deprecation notice #1612

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
31 changes: 17 additions & 14 deletions hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,16 @@ params:
# Enable Algolia DocSearch
algolia_docsearch: true
offlineSearch: false
version_menu: "Docs"
version: "Flux"
url_latest_version: /flux/
version_menu: "Versions"
version: "2.1"
archived_version: false
version_menu_pagelinks: true
url_latest_version: https://fluxcd.io/flux/
versions:
# Add your release versions here
- version: Flux
url: /flux
- version: Flagger
url: /flagger
- version: "v2.1"
url: https://fluxcd.io
- version: "v2.0"
url: https://v2-0.docs.fluxcd.io
logos:
navbar: flux-horizontal-white.png
hero: flux-horizontal-color.png
Expand Down Expand Up @@ -166,9 +167,9 @@ params:

menus:
main:
- identifier: Project
name: Project
weight: 20
- name: Documentation
url: /flux
weight: 10
- name: Code of Conduct
parent: Project
url: https://github.com/fluxcd/community/blob/main/CODE_OF_CONDUCT.md
Expand Down Expand Up @@ -211,7 +212,9 @@ menus:
- name: Ecosystem
url: /ecosystem
weight: 90
- url: https://github.com/fluxcd/flux2
name: GitHub
pre: "<i class='fab fa-github'></i> "
- name: Flagger
url: https://flagger.app
weight: 100
- identifier: Project
name: Project
weight: 110
2 changes: 2 additions & 0 deletions layouts/adopters/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<a class="td-offset-anchor"></a>
<div class="page td-content container">

{{ partial "version-banner.html" . }}

{{ .Content | markdownify }}

{{ $projects := $.Site.Data.adopters }}
Expand Down
1 change: 1 addition & 0 deletions layouts/blog/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
{{ partial "taxonomy_terms_clouds.html" . }}
</aside>
<main class="col-12 col-md-9 col-xl-8 pl-md-5 pr-md-4" role="main">
{{ partial "version-banner.html" . }}
{{ with .CurrentSection.OutputFormats.Get "rss" -}}
<a class="td-rss-button" title="RSS" href="{{ .Permalink | safeURL }}" target="_blank" rel="noopener">
<i class="fa-solid fa-rss" aria-hidden="true"></i>
Expand Down
1 change: 1 addition & 0 deletions layouts/page/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<a class="td-offset-anchor"></a>
<div class="page td-content container">
{{ partial "version-banner.html" . }}
{{ .Content }}
</div>

Expand Down
14 changes: 14 additions & 0 deletions layouts/partials/navbar-version-selector.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
{{ .Site.Params.version_menu }}
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
{{ $path := "" }}
{{ if .Site.Params.version_menu_pagelinks }}
{{ $path = .Page.RelPermalink }}
{{ end }}
<a class="dropdown-item" href="/flux/releases">Release Information</a>
{{ range .Site.Params.versions }}
<a class="dropdown-item" href="{{ .url }}{{ $path }}">{{ .version }}</a>
{{ end }}
</div>
41 changes: 21 additions & 20 deletions layouts/partials/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbarContent">
<ul class="navbar-nav mt-2 mt-lg-0">
<!-- Move docs selector forward -->
{{ if .Site.Params.versions -}}
<li class="nav-item dropdown mr-4">
{{ partial "navbar-version-selector.html" . -}}
</li>
{{ end -}}
{{ $p := . -}}
{{ range .Site.Menus.main -}}
{{ $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) -}}
Expand All @@ -60,25 +54,32 @@
{{ range .Children }}
{{ $childrenurl := urls.Parse .URL }}
<a class="dropdown-item" href="{{ with .Page }}{{ .RelPermalink }}{{ else }}{{ .URL | relLangURL }}{{ end }}" {{ if ne $childrenurl.Host $baseurl.Host }}target="_blank" {{ end }}>{{ .Name }}</a>
{{ end }}
{{ end }}
</div>
</li>
{{ else }}
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a {{/**/ -}}
class="nav-link {{- if $active }} active {{- end }}" {{/**/ -}}
href="{{ with .Page }}{{ .RelPermalink }}{{ else }}{{ .URL | relLangURL }}{{ end }}"
{{- if ne $url.Host $baseurl.Host }} target="_blank" {{- end -}}
>
{{- with .Pre }}{{ $pre }}{{ end -}}
<span {{- if $active }} class="active" {{- end }}>
{{- .Name -}}
</span>
{{- with .Post }}{{ $post }}{{ end -}}
</a>
<li class="nav-item mr-4 mb-2 mb-lg-0">
<a {{/**/ -}}
class="nav-link {{- if $active }} active {{- end }}" {{/**/ -}}
href="{{ with .Page }}{{ .RelPermalink }}{{ else }}{{ .URL | relLangURL }}{{ end }}"
{{- if ne $url.Host $baseurl.Host }} target="_blank" {{- end -}}
>
{{- with .Pre }}{{ $pre }}{{ end -}}
<span {{- if $active }} class="active" {{- end }}>
{{- .Name -}}
</span>
{{- with .Post }}{{ $post }}{{ end -}}
</a>
</li>
{{ end -}}
{{ end -}}

{{ if .Site.Params.versions -}}
<li class="nav-item dropdown mr-4">
{{ partial "navbar-version-selector.html" . -}}
</li>
{{ end -}}
{{ end -}}

{{ if (gt (len .Site.Home.Translations) 0) -}}
<li class="nav-item dropdown mr-4 d-none d-lg-block">
{{ partial "navbar-lang-selector.html" . -}}
Expand Down
17 changes: 17 additions & 0 deletions layouts/partials/version-banner.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- Check the variable that indicates whether this is an archived doc set.
If yes, display a banner. -->
{{ if .Site.Params.archived_version }}
{{ $color := "primary" }}
{{ $latest_version := .Site.Params.url_latest_version }}
{{ $current_version := .Site.Params.version }}
<div class="pageinfo pageinfo-{{ $color }} deprecation-warning">
<h3>You are viewing documentation for Flux version: {{ $current_version }}</h3>
{{ with $current_version }}<p>Version {{ . | markdownify }} of the
documentation is no longer actively maintained. The site that you are
currently viewing is an archived snapshot.
{{ with $latest_version }}For up-to-date documentation, see the
<a href="{{ $latest_version | safeURL }}" target="_blank">latest version</a>.</p>
{{ end }}
{{ end }}
</div>
{{ end }}
2 changes: 2 additions & 0 deletions layouts/resources/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<a class="td-offset-anchor"></a>
<div class="page td-content container">

{{ partial "version-banner.html" . }}

{{ .Content | markdownify }}

{{ $resources := $.Site.Data.resources.resources }}
Expand Down