Skip to content

Commit d8cebf4

Browse files
authored
Merge pull request #1588 from exoticDFT/bug/fix-json-api-jobs
Issue #1587: Fixes a bug in the JSON API for jobs
2 parents f48ff03 + e507580 commit d8cebf4

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

pages/api/jobs.json

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,22 @@ layout: none
33
permalink: /api/jobs.json
44
excluded_in_search: true
55
---
6-
{% assign sorted_jobs = site.data.jobs | sort: "posted" | reverse %}[{% for job in sorted_jobs %}{% capture nowunix %}{{'now' | date: '%s'}}{% endcapture %}{% capture expires %}{{ job.expires | date: '%s'}}{% endcapture %}{% capture posted %}{{ job.posted | date: '%b %d, %Y'}}{% endcapture %}{% if expires > nowunix %}{
6+
{%- assign sorted_jobs = site.data.jobs | sort: "posted" | reverse -%}
7+
{%- capture nowunix -%}{{'now' | date: '%s'}}{%- endcapture -%}
8+
[
9+
{%- for job in sorted_jobs -%}
10+
{%- capture expires -%}{{ job.expires | date: '%s'}}{%- endcapture -%}
11+
{%- capture posted -%}{{ job.posted | date: '%b %d, %Y'}}{%- endcapture -%}
12+
{% if expires > nowunix %}
13+
{
714
"title": {{ job.name | jsonify }},
8-
{% if posted != '' %}"published": "{{ posted }}",{% endif %}
9-
"location": {{ job.location| jsonify }},
15+
{%- if posted != '' %}
16+
"published": "{{ posted }}",
17+
{%- endif %}
18+
"location": {{ job.location | jsonify }},
1019
"url": "{{ job.url }}"
11-
}{% if forloop.last %}{% else %},{% endif %}{% endif %}
12-
{% endfor %}{}]
20+
},
21+
{%- endif %}
22+
{%- endfor %}
23+
{}
24+
]

0 commit comments

Comments
 (0)