forked from conferencias-dev/conferencias-dev
-
Notifications
You must be signed in to change notification settings - Fork 4
/
search.json
24 lines (23 loc) · 839 Bytes
/
search.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
---
---
[
{% capture now %}{{'now' | date: '%Y-%m-%d'}}{% endcapture %}
{% assign sorted_posts = site.posts | sort:"date_from" | reversed %}
{% for post in sorted_posts %}
{% capture date_from %}{{post.date_from | date: '%Y-%m-%d'}}{% endcapture %}
{% capture date_to %}{{post.date_to | date: '%Y-%m-%d'}}{% endcapture %}
{% if date_from >= now or now <= date_to %}
{
"title" : "{{ post.title | escape }}",
"tags" : "{{ post.tags | array_to_sentence_string }}",
"url" : "{{ site.baseurl }}{{ post.url }}",
"date" :
{% if post.date_from == post.date_to %}
"{{ post.date_from | date_to_string }}"
{% else %}
"{{post.date_from | date: '%d'}} - {{post.date_to | date: '%d %b %Y'}}"
{% endif %}
} {% unless forloop.last %},{% endunless %}
{% endif %}
{% endfor %}
]