Skip to content
Snippets Groups Projects
Unverified Commit 1843748e authored by Lars Bilke's avatar Lars Bilke
Browse files

[web] Added optional paramater to dataFile-shortcode to get version comp

parent 36e75722
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,14 @@
{{- $map := split . "." }}
{{- $url := index $.Site.Data $map -}}
{{- if $url -}}
{{- $url -}}
{# Second parameter allows to get a version component, starting with index 1 #}
{{- with $.Get 1 -}}
{# Start with index 1, subtract 1 to get zero-based index #}
{{- $index := math.Sub . 1 -}}
{{- $version_comps := split $url "." -}}
{{- $url = index $version_comps $index -}}
{{- end -}}
{{- $url -}}
{{- else -}}
{{- errorf "No data for key %s" . -}}
{{- end -}}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment