{{ define "main" }}

{{ partial "page-title.html" . }}

{{ $data := index site.Data site.Language.Lang }}

<!-- Portfolio Start -->
<section class="portfolio-work">
  <div class="container">
    <div class="row">
      <div class="col-md-12">
        <div class="block">
          <div class="portfolio-menu">
            <div class="btn-group btn-group-toggle justify-content-center" data-toggle="buttons">
              <label class="btn btn-sm btn-primary active">
                <input type="radio" name="shuffle-filter" value="all" checked="checked">{{ i18n "all" }}
              </label>
              {{ $categories := slice -}}
              {{ range .Data.Pages -}}
              {{ $categories = $categories | append .Params.category -}}
              {{ end -}}
              {{ range ( $categories | uniq ) -}}
              <label class="btn btn-sm btn-primary">
                <input type="radio" name="shuffle-filter" value="{{ . | urlize }}">{{ . }}
              </label>
              {{- end }}
            </div>
          </div>
          <div class="row shuffle-wrapper">
            {{ range .Data.Pages -}}
            {{ $cats := .Params.category -}}
            {{ if not (reflect.IsSlice $cats) }}{{ $cats = slice ($cats) }}{{ end -}}
            {{ $cats = apply $cats "urlize" "." | jsonify -}}
            <div class="col-md-4 portfolio-item shuffle-item" data-groups="{{ $cats }}">
              {{ if isset .Params "image" -}}
              <img src="{{ .Params.image | relURL }}" alt="{{ .Title }}">
              {{- end }}
              <div class="portfolio-hover">
                <div class="portfolio-content">
                  <a class="h3" href="{{ .RelPermalink }}">{{ .Title }}</a>
                  <p>{{ .Params.description }}</p>
                </div>
              </div>
            </div>
            {{- end }}
          </div>
        </div>
      </div>
    </div>
  </div>
</section>

{{ end }}
