mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-07-26 19:15:16 +02:00
pub widget: Add filter for publication type (Close #217)
This commit is contained in:
parent
d371607122
commit
48945c6b80
4 changed files with 37 additions and 3 deletions
|
@ -21,5 +21,15 @@ count = 10
|
|||
# 2 = Detailed
|
||||
list_format = 0
|
||||
|
||||
# Filter by publication type.
|
||||
# -1: Any
|
||||
# 0: Uncategorized
|
||||
# 1: Conference proceedings
|
||||
# 2: Journal
|
||||
# 3: Work in progress
|
||||
# 4: Technical report
|
||||
# 5: Book
|
||||
# 6: Book chapter
|
||||
publication_type = "-1"
|
||||
+++
|
||||
|
||||
|
|
|
@ -19,5 +19,15 @@ weight = 10
|
|||
# 2 = Detailed
|
||||
list_format = 2
|
||||
|
||||
# Filter by publication type.
|
||||
# -1: Any
|
||||
# 0: Uncategorized
|
||||
# 1: Conference proceedings
|
||||
# 2: Journal
|
||||
# 3: Work in progress
|
||||
# 4: Technical report
|
||||
# 5: Book
|
||||
# 6: Book chapter
|
||||
publication_type = "-1"
|
||||
+++
|
||||
|
||||
|
|
|
@ -19,7 +19,14 @@
|
|||
<div class="col-xs-12 col-md-8">
|
||||
{{ with $page.Content }}<p>{{ . | markdownify }}</p>{{ end }}
|
||||
|
||||
{{ range first $page.Params.count (where $.Data.Pages "Type" "publication") }}
|
||||
{{ if and ($page.Params.publication_type) (ne $page.Params.publication_type "-1") }}
|
||||
{{ $.Scratch.Set "recent_pubs" (where (where $.Data.Pages "Type" "publication") ".Params.publication_types" "intersect" (slice $page.Params.publication_type)) }}
|
||||
{{ else }}
|
||||
{{ $.Scratch.Set "recent_pubs" (where $.Data.Pages "Type" "publication") }}
|
||||
{{ end }}
|
||||
|
||||
{{ $recent_pubs := $.Scratch.Get "recent_pubs" }}
|
||||
{{ range first $page.Params.count $recent_pubs }}
|
||||
{{ if eq $page.Params.list_format 1 }}
|
||||
{{ partial "publication_li_classic" . }}
|
||||
{{ else if eq $page.Params.list_format 2 }}
|
||||
|
|
|
@ -10,13 +10,20 @@
|
|||
<div class="col-xs-12 col-md-8">
|
||||
{{ with $page.Content }}<p>{{ . | markdownify }}</p>{{ end }}
|
||||
|
||||
{{ range (where (where $.Data.Pages "Type" "publication") ".Params.selected" true) }}
|
||||
{{ if and ($page.Params.publication_type) (ne $page.Params.publication_type "-1") }}
|
||||
{{ $.Scratch.Set "sel_pubs" (where (where (where $.Data.Pages "Type" "publication") ".Params.selected" true) ".Params.publication_types" "intersect" (slice $page.Params.publication_type)) }}
|
||||
{{ else }}
|
||||
{{ $.Scratch.Set "sel_pubs" (where (where $.Data.Pages "Type" "publication") ".Params.selected" true) }}
|
||||
{{ end }}
|
||||
|
||||
{{ $sel_pubs := $.Scratch.Get "sel_pubs" }}
|
||||
{{ range $sel_pubs }}
|
||||
{{ if eq $page.Params.list_format 1 }}
|
||||
{{ partial "publication_li_classic" . }}
|
||||
{{ else if eq $page.Params.list_format 2 }}
|
||||
{{ partial "publication_li_detailed" . }}
|
||||
{{ else }}
|
||||
{{ partial "publication_li_simple" . }}
|
||||
{{ partial "publication_li_simple" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue