Skip to content

Commit 338a939

Browse files
committed
Return TBU image path in JSON API if its thumbnail not given yet
1 parent 2a4c218 commit 338a939

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

_includes/projects2json.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
{% capture default_thumbnail_path %}/assets/img/projects/{{ pj.year }}/{{ pj.id }}.webp{% endcapture %}
2+
{% capture default_thumbnail_exists %}{% file_exists default_thumbnail_path %}{% endcapture %}
13
[ {% for pj in projects %}
24
{
35
"id" : "{{ pj.id }}",
46
"title" : "{{ pj.title }}",
57
"description" : "{{ pj.description | escape }}",
6-
"thumbnail" : "{{ site.url }}/assets/img/projects/{{ pj.year }}/{% if pj.thumbnail %}{{ pj.thumbnail }}{% else %}{{ pj.id}}.webp{% endif %}",
8+
"thumbnail" : "{{ site.url }}/assets/img/projects/{{ pj.year }}/{% if pj.thumbnail %}{{ pj.thumbnail }}{% elsif default_thumbnail_exists %}../tbu.webp{% else %}{{ pj.id}}.webp{% endif %}",
79
"url" : "{{ site.url }}/projects/{{ pj.year }}/{{ pj.id }}",
810
"year" : "{{ pj.year }}",
911
"creators" : [

0 commit comments

Comments
 (0)