-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathportal.json
More file actions
38 lines (37 loc) · 1.54 KB
/
portal.json
File metadata and controls
38 lines (37 loc) · 1.54 KB
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
---
---
{%- assign posts = site.portal_posts | sort: 'date' | reverse -%}
{%- assign firstItemShown = false -%}
{
"version": "https://jsonfeed.org/version/1",
"title": "Portal JSON Feed",
"icon": "https://www.codeplay.com/assets/images/favicon.ico",
"home_page_url": "https://www.codeplay.com",
"feed_url": "https://www.codeplay.com/portal.json",
"items": [
{% for post in posts %}
{%- if post.sitemap == false or post.hidden == true or post.hidden == 'true' -%}{% continue %}{%- endif -%}
{%- for author in site.authors -%}
{%- assign current_author_id = author.user_id | times:1 -%}
{%- assign article_author_id = post.user_id | times:1 -%}
{%- if current_author_id == article_author_id -%}
{%- assign foundAuthor = author -%}
{%- endif -%}
{%- endfor -%}
{%- if firstItemShown -%},{%- endif -%}{
"id": "{{post.title | slugify}}",
"title": "{{ post.title | escape }}",
"authors": [{
"avatar": "{{ site.url }}/{{ site.baseurl }}{{foundAuthor.avatar}}",
"name": "{{foundAuthor.title}}"
}],
"url": "{{ site.url }}/{{ site.baseurl }}{{ post.url }}",
"category": "{{ post.category }}",
"thumbnail": "{{site.url}}/{{site.baseurl}}{{ post.thumbnail }}",
"description": "{{ post.description }}",
"date_published": "{{ post.date | date_to_long_string }}"
}
{%- assign firstItemShown = true -%}
{%- endfor -%}
]
}