Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/devcows/hugo-universal-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/partials/features.html')
-rw-r--r--layouts/partials/features.html55
1 files changed, 33 insertions, 22 deletions
diff --git a/layouts/partials/features.html b/layouts/partials/features.html
index f41f2a1..ea73ac5 100644
--- a/layouts/partials/features.html
+++ b/layouts/partials/features.html
@@ -3,30 +3,41 @@
{{ if gt (len .Site.Data.features) 0 }}
<section class="bar background-white">
<div class="container">
- {{ range $index, $element := sort .Site.Data.features "weight" }}
- {{ if eq (mod $index 3) 0 }}
- <div class="col-md-12">
- <div class="row">
+ {{ $elements := default 3 .Site.Params.features.cols }}
+ {{ $features := sort .Site.Data.features "weight" }}
+
+ {{ $total_rows := div (len $features) $elements }}
+
+ {{ if gt (mod (len $features) $elements) 0 }}
+ {{ $total_rows = add $total_rows 1 }}
{{ end }}
- <div class="col-md-4">
- <div class="box-simple">
- {{ with $element.url }}
- <a href="{{ $element.url }}">
- {{ end }}
- <div class="icon">
- <i class="{{ .icon }}"></i>
- </div>
- {{ with $element.url }}
- </a>
- {{ end }}
- <h3>{{ $element.name | markdownify }}</h3>
- <p>{{ $element.description | markdownify }}</p>
+
+ {{ range $i, $sequence := seq $total_rows }}
+ <div class="row row-{{ $i }} row-{{ if eq (mod $i 2) 0 }}odd{{ else }}even{{ end }}">
+ {{ range $j, $sequence2 := (seq $elements) }}
+
+ {{ $feature_index := add (mul $i $elements) $j }}
+ {{ if lt $feature_index (len $features) }}
+ {{ $element := index $features $feature_index }}
+
+ <div class="col-md-{{ div 12 $elements }} col-{{ $j }} col-{{ if eq (mod $j 2) 0 }}odd{{ else }}even{{ end }}">
+ <div class="box-simple">
+ {{ with $element.url }}
+ <a href="{{ $element.url }}">
+ {{ end }}
+ <div class="icon">
+ <i class="{{ $element.icon }}"></i>
+ </div>
+ {{ with $element.url }}
+ </a>
+ {{ end }}
+ <h3>{{ $element.name | markdownify }}</h3>
+ <p>{{ $element.description | markdownify }}</p>
+ </div>
</div>
- </div>
- {{ if or (eq (mod $index 3) 2) (eq $index (sub (len $.Site.Data.features) 1 )) }}
- </div>
- </div>
- {{ end }}
+ {{ end }}
+ {{ end }}
+ </div>
{{ end }}
</div>
</section>