|
@@ -1,9 +1,10 @@
|
|
{{/* Pages Widget */}}
|
|
{{/* Pages Widget */}}
|
|
|
|
+{{/* https://wowchemy.com/docs/widget/ */}}
|
|
|
|
|
|
{{/* Initialise */}}
|
|
{{/* Initialise */}}
|
|
{{ $ := .root }}
|
|
{{ $ := .root }}
|
|
{{ $st := .page }}
|
|
{{ $st := .page }}
|
|
-{{ $items_type := $st.Params.content.page_type | default "post" }}
|
|
|
|
|
|
+
|
|
{{ $items_offset := $st.Params.content.offset | default 0 }}
|
|
{{ $items_offset := $st.Params.content.offset | default 0 }}
|
|
{{ $items_count := $st.Params.content.count }}
|
|
{{ $items_count := $st.Params.content.count }}
|
|
{{ if eq $items_count 0 }}
|
|
{{ if eq $items_count 0 }}
|
|
@@ -14,10 +15,21 @@
|
|
{{ $items_sort := $st.Params.content.order | default "desc" }}
|
|
{{ $items_sort := $st.Params.content.order | default "desc" }}
|
|
|
|
|
|
{{/* Query */}}
|
|
{{/* Query */}}
|
|
-{{ $query := where site.RegularPages "Type" $items_type }}
|
|
|
|
-{{ $archive_page := site.GetPage "Section" $items_type }}
|
|
|
|
|
|
+{{ $query := site.RegularPages }}
|
|
|
|
+{{ $archive_page := "" }}
|
|
|
|
|
|
{{/* Filters */}}
|
|
{{/* Filters */}}
|
|
|
|
+{{ if $st.Params.content.page_type }}
|
|
|
|
+ {{ $query = where $query "Type" $st.Params.content.page_type }}
|
|
|
|
+ {{ $archive_page = site.GetPage "Section" $st.Params.content.page_type }}
|
|
|
|
+{{ end }}
|
|
|
|
+{{ if $st.Params.content.filters.folders }}
|
|
|
|
+ {{ $folders := $st.Params.content.filters.folders }}
|
|
|
|
+ {{ $query = where $query "Section" "in" $folders }}
|
|
|
|
+ {{/* Init archive page to main folder */}}
|
|
|
|
+ {{ $main_folder := index $folders 0 }}
|
|
|
|
+ {{ $archive_page = site.GetPage "Section" $main_folder }}
|
|
|
|
+{{ end }}
|
|
{{ if $st.Params.content.filters.tag }}
|
|
{{ if $st.Params.content.filters.tag }}
|
|
{{ $archive_page = site.GetPage (printf "tags/%s" (urlize $st.Params.content.filters.tag)) }}
|
|
{{ $archive_page = site.GetPage (printf "tags/%s" (urlize $st.Params.content.filters.tag)) }}
|
|
{{ $query = $query | intersect $archive_page.Pages }}
|
|
{{ $query = $query | intersect $archive_page.Pages }}
|
|
@@ -57,31 +69,19 @@
|
|
{{ $query = first $items_count $query }}
|
|
{{ $query = first $items_count $query }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
|
|
-{{/* Localisation */}}
|
|
|
|
-{{ $i18n := "" }}
|
|
|
|
-{{ if eq $items_type "post" }}
|
|
|
|
- {{ $i18n = "more_posts" }}
|
|
|
|
-{{ else if eq $items_type "event" }}
|
|
|
|
- {{ $i18n = "more_talks" }}
|
|
|
|
-{{ else if eq $items_type "publication" }}
|
|
|
|
- {{ $i18n = "more_publications" }}
|
|
|
|
-{{ else }}
|
|
|
|
- {{ $i18n = "more_pages" }}
|
|
|
|
-{{ end }}
|
|
|
|
-
|
|
|
|
{{ $columns := $st.Params.design.columns | default "2" }}
|
|
{{ $columns := $st.Params.design.columns | default "2" }}
|
|
|
|
|
|
<div class="col-12 {{if eq $columns "2"}}col-lg-8{{end}}">
|
|
<div class="col-12 {{if eq $columns "2"}}col-lg-8{{end}}">
|
|
|
|
|
|
{{ with $st.Content }}{{ . }}{{ end }}
|
|
{{ with $st.Content }}{{ . }}{{ end }}
|
|
|
|
|
|
- {{ range $index, $post := $query }}
|
|
|
|
|
|
+ {{ range $index, $item := $query }}
|
|
{{ partial "functions/render_view" (dict "page" $st "item" . "view" ($st.Params.design.view | default "compact") "index" $index) }}
|
|
{{ partial "functions/render_view" (dict "page" $st "item" . "view" ($st.Params.design.view | default "compact") "index" $index) }}
|
|
{{end}}
|
|
{{end}}
|
|
|
|
|
|
{{/* Archive link */}}
|
|
{{/* Archive link */}}
|
|
{{ $show_archive_link := $st.Params.content.archive.enable | default (gt $count $items_count) }}
|
|
{{ $show_archive_link := $st.Params.content.archive.enable | default (gt $count $items_count) }}
|
|
- {{ if $show_archive_link }}
|
|
|
|
|
|
+ {{ if $show_archive_link | and $archive_page }}
|
|
|
|
|
|
{{ $archive_link := "" }}
|
|
{{ $archive_link := "" }}
|
|
{{ if $st.Params.content.archive.link }}
|
|
{{ if $st.Params.content.archive.link }}
|
|
@@ -90,6 +90,19 @@
|
|
{{ $archive_link = $archive_page.RelPermalink }}
|
|
{{ $archive_link = $archive_page.RelPermalink }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
|
|
|
|
+ {{/* Localisation */}}
|
|
|
|
+ {{ $items_type := $archive_page.Type }}
|
|
|
|
+ {{ $i18n := "" }}
|
|
|
|
+ {{ if eq $items_type "post" }}
|
|
|
|
+ {{ $i18n = "more_posts" }}
|
|
|
|
+ {{ else if eq $items_type "event" }}
|
|
|
|
+ {{ $i18n = "more_talks" }}
|
|
|
|
+ {{ else if eq $items_type "publication" }}
|
|
|
|
+ {{ $i18n = "more_publications" }}
|
|
|
|
+ {{ else }}
|
|
|
|
+ {{ $i18n = "more_pages" }}
|
|
|
|
+ {{ end }}
|
|
|
|
+
|
|
{{ $archive_text := $st.Params.content.archive.text | default (i18n $i18n) | default "See all" }}
|
|
{{ $archive_text := $st.Params.content.archive.text | default (i18n $i18n) | default "See all" }}
|
|
|
|
|
|
<div class="see-all">
|
|
<div class="see-all">
|