Merge pull request #103 from influxdata/stable-version

Added flexible stable version messages, minify html on build
pull/104/head
Scott Anderson 2019-03-22 15:18:00 -06:00 committed by GitHub
commit dce8c04862
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 28 additions and 22 deletions

View File

@ -30,7 +30,7 @@ jobs:
- /home/circleci/bin
- run:
name: Hugo Build
command: $HOME/bin/hugo -v --destination workspace/public
command: $HOME/bin/hugo -v --minify --destination workspace/public
- persist_to_workspace:
root: workspace
paths:

View File

@ -1 +1 @@
latest_version: v2.0
stable_version: v2.0

View File

@ -5,9 +5,9 @@
Welcome to the InfluxDB v2.x documentation
</p>
<p>
This page is never actually shown on the live docs since visiting the docs domain will redirect to the latest version.
This page is never actually shown on the live docs since visiting the docs domain will redirect to the latest stable version.
Select your desired version from the dropdown above or go straight to the
<a href="/{{ $.Site.Data.versions.latest_version }}">latest version</a>.
<a href="/{{ $.Site.Data.versions.stable_version }}">latest stable version</a>.
</p>
</div>

View File

@ -1,12 +1,12 @@
<div class="article">
<article class="article--content">
<h1>{{ .Title }}</h1>
{{ partial "article/latest-version.html" . }}
{{ partial "article/stable-version.html" . }}
{{ partial "article/enterprise.html" . }}
{{ partial "article/cloud.html" . }}
{{ .Content }}
{{ partial "article/tags.html" . }}
{{ if in .RelPermalink "/cloud/"}}
{{ partial "article/_cloud-feedback.html"}}
{{ else }}

View File

@ -1,11 +0,0 @@
{{ $currentVersion := (index (findRE "[^/]+.*?" .RelPermalink) 0) .RelPermalink }}
{{ $latestVersion := $.Site.Data.versions.latest_version }}
{{ $latestVersionURL := replaceRE "[^/]+.*?[0]" $latestVersion .RelPermalink }}
{{ if not (eq $currentVersion $latestVersion) }}
<div class="warn old-version">
<p>
This page documents an earlier version of InfluxDB.
View the latest version of this page in the <a href="{{ $latestVersionURL }}">InfluxDB {{ $latestVersion }}</a> documentation.
</p>
</div>
{{ end }}

View File

@ -0,0 +1,18 @@
{{ $currentVersion := (index (findRE "[^/]+.*?" .RelPermalink) 0) .RelPermalink }}
{{ $stableVersion := $.Site.Data.versions.stable_version }}
{{ $stableVersionURL := replaceRE "[^/]+.*?[0]" $stableVersion .RelPermalink }}
{{ if lt $currentVersion $stableVersion }}
<div class="warn old-version">
<p>
This page documents an earlier version of InfluxDB. InfluxDB {{ $stableVersion }} is the latest stable version.<br/>
<a href="{{ $stableVersionURL }}">View this page in the {{ $stableVersion }} documentation</a>.
</p>
</div>
{{ else if gt $currentVersion $stableVersion }}
<div class="note old-version">
<p>
This page documents a pre-release version of InfluxDB. InfluxDB {{ $stableVersion }} is the latest stable version.<br/>
<a href="{{ $stableVersionURL }}">View this page in the {{ $stableVersion }} documentation</a>.
</p>
</div>
{{ end }}

View File

@ -1,8 +1,7 @@
{{ $currentVersion := (index (findRE "[^/]+.*?" .RelPermalink) 0) .RelPermalink }}
{{ $latestVersion := $.Site.Data.versions.latest_version }}
{{ $latestPath := replaceRE "[^/]+.*?[0]" $latestVersion .RelPermalink }}
{{ $canonicalURL := print (replaceRE `\/$` "" .Site.BaseURL) (replaceRE "[^/]+.*?[0]" $latestVersion .RelPermalink) }}
{{ $stableVersion := $.Site.Data.versions.stable_version }}
{{ $canonicalURL := print (replaceRE `\/$` "" .Site.BaseURL) (replaceRE "[^/]+.*?[0]" $stableVersion .RelPermalink) }}
{{ if not (eq $currentVersion $latestVersion) }}
{{ if not (eq $currentVersion $stableVersion) }}
<link rel="canonical" href="{{ $canonicalURL }}" />
{{ end }}

View File

@ -5,7 +5,7 @@
<span class="icon-influx-logotype"></span>
</a>
<span class="divider"></span>
<a class="docs-home" href="/{{ $.Site.Data.versions.latest_version }}">Docs</a>
<a class="docs-home" href="/{{ $.Site.Data.versions.stable_version }}">Docs</a>
</div>
<div class="topnav--right">
<div class="version-selector">