Latest patch shortcode (#2561)
* added latest-patch shortcode, updated products.yml with latest patches * added latest-patch info to contributing * Update CONTRIBUTING.md Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com> Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>pull/2562/head
parent
2937f41432
commit
3556829d8e
|
|
@ -325,6 +325,14 @@ Use the following for project names:
|
|||
/{{< latest "telegraf" >}}/
|
||||
```
|
||||
|
||||
### Latest patch version
|
||||
Use the `{{< latest-patch >}}` shortcode to add the latest patch version of the
|
||||
current product. Easier to maintain being you update the version number in the `data/products.yml` file instead of updating individual links and code examples.
|
||||
|
||||
```md
|
||||
{{< latest-patch >}}
|
||||
```
|
||||
|
||||
### Tabbed Content
|
||||
Shortcodes are available for creating "tabbed" content (content that is changed by a users' selection).
|
||||
Ther following three must be used:
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ influxdb:
|
|||
versions: [v1.3, v1.4, v1.5, v1.6, v1.7, v1.8, v2.0]
|
||||
latest: v2.0
|
||||
latest_override: v2.0
|
||||
latest_patches:
|
||||
"2.0": 6
|
||||
|
||||
influxdb_cloud:
|
||||
name: InfluxDB Cloud
|
||||
|
|
@ -43,3 +45,8 @@ enterprise_influxdb:
|
|||
list_order: 3
|
||||
versions: [v1.5, v1.6, v1.7, v1.8]
|
||||
latest: v1.8
|
||||
latest_patches:
|
||||
"1.5": 4
|
||||
"1.6": 6
|
||||
"1.7": 10
|
||||
"1.8": 5
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
{{- $scratch := newScratch -}}
|
||||
{{- $productPathData := findRE "[^/]+.*?" .Page.RelPermalink -}}
|
||||
{{- $product := index $productPathData 0 | default "influxdb" -}}
|
||||
{{- $currentVersion := replaceRE "v" "" (index $productPathData 1) -}}
|
||||
{{- $latestVersion := replaceRE "v" "" (index (index .Site.Data.products $product) "latest") -}}
|
||||
{{- $patchVersions := index (index .Site.Data.products $product) "latest_patches" -}}
|
||||
{{- if eq $currentVersion "cloud" -}}
|
||||
{{- $scratch.Set "patchVersion" (print $latestVersion "." (index $patchVersions $latestVersion)) -}}
|
||||
{{- else -}}
|
||||
{{- $scratch.Set "patchVersion" (print $currentVersion "." (index $patchVersions $currentVersion)) -}}
|
||||
{{- end -}}
|
||||
{{- $scratch.Get "patchVersion" -}}
|
||||
Loading…
Reference in New Issue