|
@@ -0,0 +1,93 @@
|
|
|
|
+{{/* Pages Widget */}}
|
|
|
|
+
|
|
|
|
+{{/* Initialise */}}
|
|
|
|
+{{ $ := .root }}
|
|
|
|
+{{ $st := .page }}
|
|
|
|
+{{ $items_type := $st.Params.content.page_type | default "post" }}
|
|
|
|
+{{ $items_offset := $st.Params.content.offset | default 0 }}
|
|
|
|
+{{ $items_count := $st.Params.content.count | default 5 }}
|
|
|
|
+{{ $items_sort := $st.Params.content.order| default "desc" }}
|
|
|
|
+
|
|
|
|
+{{/* Query */}}
|
|
|
|
+{{ $query := where $.Site.RegularPages "Type" $items_type }}
|
|
|
|
+{{ $archive_page := $.Site.GetPage "Section" $items_type }}
|
|
|
|
+
|
|
|
|
+{{/* Filters */}}
|
|
|
|
+{{ if $st.Params.content.filters.tag }}
|
|
|
|
+ {{ $archive_page = $.Site.GetPage (printf "tags/%s" $st.Params.filters.content.tag) }}
|
|
|
|
+ {{ $query = $query | intersect $archive_page.Pages }}
|
|
|
|
+{{ end }}
|
|
|
|
+{{ if $st.Params.content.filters.category }}
|
|
|
|
+ {{ $archive_page = $.Site.GetPage (printf "categories/%s" $st.Params.filters.content.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 }}
|
|
|
|
+{{ if $st.Params.content.filters.exclude_featured }}
|
|
|
|
+ {{ $query = where $query "Params.featured" "!=" true }}
|
|
|
|
+{{ end }}
|
|
|
|
+
|
|
|
|
+{{/* Offset */}}
|
|
|
|
+{{ if gt $items_offset 0 }}
|
|
|
|
+ {{ $query = first $items_count (after $items_offset $query) }}
|
|
|
|
+{{ else }}
|
|
|
|
+ {{ $query = first $items_count $query }}
|
|
|
|
+{{ end }}
|
|
|
|
+
|
|
|
|
+{{/* Sort */}}
|
|
|
|
+{{ $sort_by := "" }}
|
|
|
|
+{{ if eq $items_type "talk" }}
|
|
|
|
+ {{ $sort_by = "Params.time_start" }}
|
|
|
|
+{{ else }}
|
|
|
|
+ {{ $sort_by = "Date" }}
|
|
|
|
+{{ end }}
|
|
|
|
+
|
|
|
|
+{{ $query = sort $query $sort_by $items_sort }}
|
|
|
|
+{{ $count := len $query }}
|
|
|
|
+
|
|
|
|
+{{/* Localisation */}}
|
|
|
|
+{{ $i18n := "" }}
|
|
|
|
+{{ if eq $items_type "post" }}
|
|
|
|
+ {{ $i18n = "more_posts" }}
|
|
|
|
+{{ else if eq $items_type "talk" }}
|
|
|
|
+ {{ $i18n = "more_talks" }}
|
|
|
|
+{{ else if eq $items_type "publication" }}
|
|
|
|
+ {{ $i18n = "more_publications" }}
|
|
|
|
+{{ else }}
|
|
|
|
+ {{ $i18n = "more_pages" }}
|
|
|
|
+{{ end }}
|
|
|
|
+
|
|
|
|
+<div class="row">
|
|
|
|
+ <div class="col-12 col-lg-4 section-heading">
|
|
|
|
+ <h1>{{ with $st.Title }}{{ . | markdownify | emojify }}{{ end }}</h1>
|
|
|
|
+ {{ with $st.Params.subtitle }}<p>{{ . | markdownify | emojify }}</p>{{ end }}
|
|
|
|
+ </div>
|
|
|
|
+ <div class="col-12 col-lg-8">
|
|
|
|
+
|
|
|
|
+ {{ with $st.Content }}<p>{{ . }}</p>{{ end }}
|
|
|
|
+
|
|
|
|
+ {{ range $post := $query }}
|
|
|
|
+ {{ if eq $st.Params.design.view 1 }}
|
|
|
|
+ {{ partial "li_list" . }}
|
|
|
|
+ {{ else if eq $st.Params.design.view 3 }}
|
|
|
|
+ {{ partial "li_card" . }}
|
|
|
|
+ {{ else if eq $st.Params.design.view 3 | and (eq $st.Type "publication") }}
|
|
|
|
+ {{ partial "li_citation" . }}
|
|
|
|
+ {{ else }}
|
|
|
|
+ {{ partial "li_compact" . }}
|
|
|
|
+ {{ end }}
|
|
|
|
+ {{end}}
|
|
|
|
+
|
|
|
|
+ {{ if gt $count $items_count }}
|
|
|
|
+ <div class="see-all">
|
|
|
|
+ <a href="{{ $archive_page.RelPermalink }}">
|
|
|
|
+ {{ i18n $i18n | default "See all" }}
|
|
|
|
+ <i class="fas fa-angle-right"></i>
|
|
|
|
+ </a>
|
|
|
|
+ </div>
|
|
|
|
+ {{ end }}
|
|
|
|
+
|
|
|
|
+ </div>
|
|
|
|
+</div>
|