forked from greenelab/lab-website-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist.html
75 lines (64 loc) · 1.98 KB
/
list.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{%- assign emptyarray = "" | split: "," -%}
{%- assign data = site.data[include.data] | default: site[include.data] | default: emptyarray -%}
{%- assign component = include.component | append: ".html" -%}
{%- assign filters = include.filters | split: "," -%}
{%- for filter in filters -%}
{%- assign entry = filter | split: ":" -%}
{%- assign key = entry[0] | strip -%}
{%- assign value = entry[1] | strip | default: nil -%}
{%- if value contains "~" -%}
{%- assign value = value | remove: "~" -%}
{%- assign data = data | where_exp: "d", "d[key] contains value" -%}
{%- else -%}
{%- assign tonumber = value | plus: 0 -%}
{%- capture numbertostring -%}{{- tonumber -}}{%- endcapture -%}
{%- if value == numbertostring -%}
{%- assign value = tonumber -%}
{%- elsif value == "true" -%}
{%- assign value = true -%}
{%- elsif value == "false" -%}
{%- assign value = false -%}
{%- endif -%}
{%- assign data = data | where_exp: "d", "d[key] == value" -%}
{%- endif -%}
{%- endfor -%}
{%- assign years = data | group_by_exp: "d", "d.date | date: '%Y'" | sort: "name" | reverse -%}
{%- for year in years -%}
{%- assign items = year.items -%}
{%- if years.size > 1 -%}
<h3 id="{{ year.name }}">{{ year.name }}</h3>
{%- assign items = items | sort: "date" | reverse -%}
{%- endif -%}
{%- for d in items -%}
{%- assign link = d.link | default: d.url -%}
{%- assign style = d.style | default: include.style -%}
{%-
include {{ component }}
author=d.author
authors=d.authors
caption=d.caption
content=d.content
date=d.date
description=d.description
extra-links=d.extra-links
height=d.height
icon=d.icon
id=d.id
image=d.image
link=link
publisher=d.publisher
repo=d.repo
role=d.role
slug=d.slug
style=style
subtitle=d.subtitle
tags=d.tags
title=d.title
text=d.text
tooltip=d.tooltip
type=d.type
url=d.url
width=d.width
-%}
{%- endfor -%}
{%- endfor -%}