Einheiten Reihenfolge wie in den JSON-Daten angegeben
This commit is contained in:
@@ -1 +1 @@
|
||||
{{- $category := .category }}{{ $units := .units }}{{ $available := partial "available-units.html" (dict "category" $category "units" $units) }}{{ $url := "" }}{{ if gt (len $available) 0 }}{{ $firstUnit := "" }}{{ $secondUnit := "" }}{{ range $u, $_ := $available }}{{ if eq $firstUnit "" }}{{ $firstUnit = $u }}{{ else if eq $secondUnit "" }}{{ $secondUnit = $u }}{{ end }}{{ end }}{{ $url = printf "/%s-in-%s/" $firstUnit $secondUnit }}{{ end }}{{- $url -}}
|
||||
{{- $category := .category }}{{ $units := .units }}{{ $available := partial "available-units.html" (dict "category" $category "units" $units) }}{{ $url := "" }}{{ if gt (len $available) 0 }}{{ $catData := index hugo.Data $category }}{{ $firstUnit := "" }}{{ $secondUnit := "" }}{{ range $catData.unitOrder }}{{ $unitData := index $available . }}{{ if $unitData }}{{ if eq $firstUnit "" }}{{ $firstUnit = . }}{{ else if eq $secondUnit "" }}{{ $secondUnit = . }}{{ end }}{{ end }}{{ end }}{{ $url = printf "/%s-in-%s/" $firstUnit $secondUnit }}{{ end }}{{- $url -}}
|
||||
|
||||
@@ -9,12 +9,14 @@
|
||||
<div><b>{{ $data.name }}</b></div>
|
||||
<ul class="pl-1 text-xs">
|
||||
{{ $count := 0 }}
|
||||
{{ range $unitSlug, $unitData := $units }}
|
||||
{{ if lt $count 12 }}
|
||||
{{ range $data.unitOrder }}
|
||||
{{ $unitSlug := . }}
|
||||
{{ $unitData := index $units $unitSlug }}
|
||||
{{ if and $unitData (lt $count 12) }}
|
||||
{{ $toSlug := "" }}
|
||||
{{ range $u, $ud := $units }}
|
||||
{{ if and (ne $u $unitSlug) (eq $toSlug "") }}
|
||||
{{ $toSlug = $u }}
|
||||
{{ range $data.unitOrder }}
|
||||
{{ if and (ne . $unitSlug) (eq $toSlug "") }}
|
||||
{{ $toSlug = . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $url := printf "/%s-in-%s/" $unitSlug $toSlug }}
|
||||
|
||||
Reference in New Issue
Block a user