Files
HugoBlox-kit/modules/blox-bootstrap/layouts/section/publication.html
T
2023-11-07 23:09:38 +00:00

73 lines
2.5 KiB
HTML

{{- define "main" -}}
{{/* Require Isotope */}}
{{ $.Page.Store.Set "has_isotope" true }}
{{ partial "page_header.html" . }}
<div class="universal-wrapper">
<div class="row">
<div class="col-lg-12">
{{ with .Content }}
<div class="article-style">{{ . }}</div>
{{ end }}
{{/* Array of distinct years. */}}
{{ range .Pages.ByDate.Reverse }}
{{ $year := print (.Date.Format "2006") }}
{{ $.Scratch.SetInMap "years" $year $year }}
{{ end }}
<div class="form-row mb-4">
<div class="col-auto">
<input type="search" class="filter-search form-control form-control-sm" placeholder="{{ i18n "search_placeholder" }}" autocapitalize="off"
autocomplete="off" autocorrect="off" role="textbox" spellcheck="false">
</div>
<div class="col-auto">
<select class="pub-filters pubtype-select form-control form-control-sm" data-filter-group="pubtype">
<option value="*">{{ i18n "publication_type" }}</option>
{{ range $index, $taxonomy := site.Taxonomies.publication_types }}
<option value=".pubtype-{{ $index }}">
{{ i18n (printf "pub_%s" (strings.Replace $index "-" "_")) | default (strings.Title $index) }}
</option>
{{ end }}
</select>
</div>
<div class="col-auto">
<select class="pub-filters form-control form-control-sm" data-filter-group="year">
<option value="*">{{ i18n "date" }}</option>
{{ $years_sorted := $.Scratch.GetSortedMapValues "years" }}
{{ if $years_sorted }}
{{ range $year := sort $years_sorted "" "desc" }}
<option value=".year-{{ $year }}">
{{ $year }}
</option>
{{ end }}
{{ end }}
</select>
</div>
</div>
<div id="container-publications">
{{ range $index, $item := .Pages.ByDate.Reverse }}
{{ if .Params.publication_types }}
{{ $.Scratch.Set "pubtype" (index .Params.publication_types 0) }}
{{ else }}
{{ $.Scratch.Set "pubtype" 0 }}
{{ end }}
<div class="grid-sizer col-lg-12 isotope-item pubtype-{{ $.Scratch.Get "pubtype" }} year-{{ .Date.Format "2006" }}">
{{ partial "functions/render_view" (dict "page" $ "item" . "view" ($.Params.view | default "compact") "index" $index) }}
</div>
{{ end }}
</div>
</div>
</div>
</div>
{{- end -}}