60 lines
2 KiB
HTML
60 lines
2 KiB
HTML
{{/* Featured Content Widget */}}
|
|
|
|
{{/* Initialise */}}
|
|
{{ $ := .root }}
|
|
{{ $st := .page }}
|
|
{{ $items_type := $st.Params.content.page_type | default "post" }}
|
|
{{ $items_count := $st.Params.content.count | default 65535 }}
|
|
{{ $items_sort := $st.Params.content.order| default "desc" }}
|
|
|
|
{{/* Query */}}
|
|
{{ $query := where (where site.RegularPages "Type" $items_type) "Params.featured" true }}
|
|
|
|
{{/* Filters */}}
|
|
{{ if $st.Params.content.filters.tag }}
|
|
{{ $archive_page := site.GetPage (printf "tags/%s" $st.Params.content.filters.tag) }}
|
|
{{ $query = $query | intersect $archive_page.Pages }}
|
|
{{ end }}
|
|
{{ if $st.Params.content.filters.category }}
|
|
{{ $archive_page := site.GetPage (printf "categories/%s" $st.Params.content.filters.category) }}
|
|
{{ $query = $query | intersect $archive_page.Pages }}
|
|
{{ end }}
|
|
{{ if $st.Params.content.filters.publication_type }}
|
|
{{ $archive_page := site.GetPage (printf "publication_types/%s" $st.Params.content.filters.publication_type) }}
|
|
{{ $query = $query | intersect $archive_page.Pages }}
|
|
{{ end }}
|
|
|
|
{{/* Sort */}}
|
|
{{ $sort_by := "Date" }}
|
|
{{ $query = sort $query $sort_by $items_sort }}
|
|
|
|
{{/* Limit */}}
|
|
{{ $query = first $items_count $query }}
|
|
|
|
<div class="row">
|
|
<div class="col-12 section-heading text-center">
|
|
<h1>{{ with $st.Title }}{{ . | markdownify | emojify }}{{ end }}</h1>
|
|
{{ with $st.Params.subtitle }}<p>{{ . | markdownify | emojify }}</p>{{ end }}
|
|
</div>
|
|
<div class="col-12">
|
|
<div class="row justify-content-center">
|
|
|
|
{{/* <p>{{ $st.Content }}</p> */}}
|
|
{{ range $post := $query }}
|
|
{{ if eq $st.Params.design.view 1 }}
|
|
{{ partial "li_list" . }}
|
|
{{ else if eq $st.Params.design.view 3 }}
|
|
<div class="col-lg-4 col-md-6 mb-4">
|
|
{{ partial "li_card" . }}
|
|
</div>
|
|
{{ else if eq $st.Params.design.view 4 | and (eq $items_type "publication") }}
|
|
{{ partial "li_citation" . }}
|
|
{{ else }}
|
|
{{ partial "li_compact" . }}
|
|
{{ end }}
|
|
{{end}}
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|