From 815db04ac7c145ad564e97a1cb12a45ec6f586ef Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 29 Jul 2020 15:58:28 -0600 Subject: [PATCH] updated page title generation and other templated items --- content/influxdb/v2.0/_index.md | 2 +- layouts/_default/version-landing.html | 7 +++++-- layouts/partials/header.html | 13 ++++++++++--- layouts/partials/topnav.html | 18 ++++++++++-------- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/content/influxdb/v2.0/_index.md b/content/influxdb/v2.0/_index.md index cb0482ab4..b37f52926 100644 --- a/content/influxdb/v2.0/_index.md +++ b/content/influxdb/v2.0/_index.md @@ -4,7 +4,7 @@ description: > Learn how to use and leverage InfluxDB in use cases such as monitoring metrics, IoT data, and events. layout: version-landing menu: - versions: + influxdb: name: v2.0 aliases: - /v2.0/ diff --git a/layouts/_default/version-landing.html b/layouts/_default/version-landing.html index 0b47419d5..445223099 100644 --- a/layouts/_default/version-landing.html +++ b/layouts/_default/version-landing.html @@ -1,5 +1,9 @@ {{ partial "header.html" . }} +{{ $productPathData := findRE "[^/]+.*?" .RelPermalink }} +{{ $product := index $productPathData 0 }} +{{ $currentVersion := index $productPathData 1 }} +
{{ partial "sidebar.html" . }}
@@ -7,8 +11,7 @@
- {{ $currentVersion := replaceRE "v" "" (index (findRE "[^/]+.*?" .RelPermalink) 0) }} -

Get started with InfluxDB {{ $currentVersion }}

+

Get started with InfluxDB {{ replaceRE "v" "" $currentVersion }}

Start with InfluxDB Cloud Start with InfluxDB OSS
diff --git a/layouts/partials/header.html b/layouts/partials/header.html index e8f367bbf..40f2edc01 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,12 +1,19 @@ -{{ $currentVersion := replaceRE "v" "" (index (findRE "[^/]+.*?" .RelPermalink) 0) }} +{{ $productPathData := findRE "[^/]+.*?" .RelPermalink }} +{{ $product := index $productPathData 0 }} +{{ $currentVersion := index $productPathData 1 }} + {{ partial "header/google-analytics-head.html" }} - {{ if in .RelPermalink "/cloud/"}} - {{ if .Params.seotitle }} {{ print .Params.seotitle " | " }} {{ else if .Title }} {{ print .Title " | " }}{{ end }}{{ .Site.Data.products.cloud.name }} Documentation + {{ if eq $product nil }} + InfluxData Documentation + {{ else if eq $currentVersion nil}} + {{ (index .Site.Data.products $product).name }} Documentation + {{ else if eq (len $productPathData) 2 }} + {{ (index .Site.Data.products $product).name }} {{ $currentVersion }} Documentation {{ else }} {{ if .Params.seotitle }} {{ print .Params.seotitle " | " }} {{ else if .Title }} {{ print .Title " | " }} {{ end }}InfluxDB {{ if $currentVersion }}{{print $currentVersion " " }}{{ end }}Documentation {{ end }} diff --git a/layouts/partials/topnav.html b/layouts/partials/topnav.html index 46046ad91..aa150f36d 100644 --- a/layouts/partials/topnav.html +++ b/layouts/partials/topnav.html @@ -1,3 +1,7 @@ +{{ $productPathData := findRE "[^/]+.*?" .RelPermalink }} +{{ $product := index $productPathData 0 }} +{{ $currentVersion := index $productPathData 1 }} +
@@ -5,22 +9,20 @@ InfluxDB Docs
+ {{ if or (eq $product nil) (eq $currentVersion nil) }} + {{ else }}
- {{- $currentVersion := (index (findRE "[^/]+.*?" .RelPermalink) 0) -}} - {{ if not ( in $currentVersion "v2") }} -

Select Version

- {{ else }} -

{{ $currentVersion }}

- {{ end }} +

{{ $currentVersion }}

    - {{ range .Site.Menus.versions.ByName.Reverse }} + {{ range (index .Site.Menus $product).ByName.Reverse }}
  • {{ .Name }}
  • {{ end }} -
  • v1.x
  • +
  • v0.x
+ {{ end }}