-
Notifications
You must be signed in to change notification settings - Fork 1
/
feed.json
64 lines (64 loc) · 2.9 KB
/
feed.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
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
---
---
{
"version": "https://jsonfeed.org/version/1",
{%- if site.title -%}
"title": {{- site.title | smartify | jsonify -}},
{%- elsif site.name -%}
"title": {{- site.name | smartify | jsonify -}},
{%- endif -%}
{%- if site.description -%}
"description": {{- site.description | jsonify -}},
{%- endif -%}
"home_page_url": {{- '/' | absolute_url | jsonify -}},
"feed_url": {{- page.url | absolute_url | jsonify -}},
{%- if site.author -%}
"author": {
"name": {{- site.author.name | default: site.author | jsonify -}}
{%- if site.author.uri -%}
, "url": {{- site.author.uri | jsonify -}}
{%- endif -%}
{%- if site.author.avatar -%}
, "avatar": {{- site.author.avatar | jsonify -}}
{%- endif -%}
},
{%- endif -%}
"items": [
{%- assign posts = site.categories.blog | where_exp: "post", "post.draft != true" -%}
{%- for post in posts limit: 10 -%}
{
"id": {{- post.id | absolute_url | jsonify -}},
"url": {{- post.url | absolute_url | jsonify -}},
"title": {{- post.title | smartify | strip_html | normalize_whitespace | jsonify -}},
"content_html": {{- post.content | strip | jsonify -}},
{%- if post.excerpt and post.excerpt != empty -%}
"summary": {{- post.excerpt | strip_html | normalize_whitespace | jsonify -}},
{%- endif -%}
{%- assign post_image = post.image.path | default: post.image -%}
{%- if post_image -%}
{%- unless post_image contains "://" -%}
{%- assign post_image = post_image | absolute_url | xml_escape -%}
{%- endunless -%}
"image": {{- post_image | jsonify -}},
{%- endif -%}
{%- assign post_banner_image = post.banner_image.path | default: post.banner_image -%}
{%- if post_banner_image -%}
"banner_image": {{- post_banner_image | jsonify -}},
{%- endif -%}
"date_published": "{{- post.date | date_to_xmlschema -}}",
"date_modified": "{{- post.last_modified_at | default: post.date | date_to_xmlschema -}}",
{%- assign post_author = post.author | default: post.authors[0] | default: site.author -%}
{%- assign post_author = site.data.authors[post_author] | default: post_author -%}
{%- assign post_author_uri = post_author.uri | default: nil -%}
{%- assign post_author_name = post_author.name | default: post_author -%}
"author": {
"name": {{- post_author_name | default: "" | jsonify -}}
{%- if post_author_uri != nil -%}
, "url": {{- post_author_uri | jsonify -}}
{%- endif -%}
},
"tags": {{- post.tags | jsonify -}}
}{%- unless forloop.last == true -%},{%- endunless -%}
{%- endfor -%}
]
}