Skip to content

Commit

Permalink
Fun with symlinks, adding API v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Artaud committed Jan 18, 2019
1 parent e11533e commit a11a44d
Show file tree
Hide file tree
Showing 16 changed files with 64 additions and 13 deletions.
1 change: 1 addition & 0 deletions _api
18 changes: 16 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,22 @@ plugins:
collections:
vendors:
output: true
permalink: :title
badges:
api:
output: true

defaults:
-
scope:
path: "_vendors"
values:
layout: vendor
permalink: :title
-
scope:
path: "_api"
values:
layout: api
permalink: /api/v2/:title/

# Exclude from processing.
# The following items will not be processed, by default. Create a custom list
Expand Down
1 change: 1 addition & 0 deletions _layouts/api.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Testing that funny JSON API
23 changes: 23 additions & 0 deletions _vendors/all.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
limit: 100
---
{"vendors": [
{% assign sorted_vendors = site.vendors | sort: "award" | reverse %}
{% for vendor in sorted_vendors limit: page.limit %}
{
"name": {{ vendor.name | jsonify }},
"manufacturer": [{% for v in vendor.manufacturer %}"{{ v }}"{% unless forloop.last %},{% endunless %}{% endfor %}],
"url": {{ vendor.url | jsonify }},
"award": {{ vendor.award | jsonify }},
"position": {{ vendor.position | jsonify }},
"explanation": {{ vendor.explanation | markdownify | replace: 'src="/assets/img/',
'src="https://dontkillmyapp.com/assets/img/' | jsonify }},
"user_solution": {{ vendor.user_solution | markdownify | replace: 'src="/assets/img/',
'src="https://dontkillmyapp.com/assets/img/' | jsonify }},
"developer_solution": {{ vendor.developer_solution | markdownify | replace: 'src="/assets/img/',
'src="https://dontkillmyapp.com/assets/img/' | jsonify }}
}
{% unless forloop.last %},{% endunless %}
{% endfor %}
]
}
1 change: 0 additions & 1 deletion _vendors/general.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
name: Other vendors
layout: vendor
explanation: "
Whatever device you are using, don't blame the developers as the first thing when something goes wrong.
First check your phone settings whether some background processing is not restricted on your device.
Expand Down
1 change: 0 additions & 1 deletion _vendors/htc.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
name: HTC
layout: vendor
manufacturer:
- htc
position: 8
Expand Down
1 change: 0 additions & 1 deletion _vendors/huawei.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
name: Huawei
layout: vendor
manufacturer:
- huawei
redirect_from: /vendors/huawei.html
Expand Down
1 change: 0 additions & 1 deletion _vendors/lenovo.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name: Lenovo
manufacturer:
- lenovo
layout: vendor
position: 10
award: 1
explanation: "We're still gathering more information on battery saving features on Lenovo phones."
Expand Down
1 change: 0 additions & 1 deletion _vendors/meizu.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
name: Meizu
layout: vendor
manufacturer:
- meizu
award: 3
Expand Down
1 change: 0 additions & 1 deletion _vendors/nokia.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Nokia
manufacturer:
- nokia
- hmd global
layout: vendor
redirect_from:
- /vendors/nokia.html
- /hmd%20global
Expand Down
1 change: 0 additions & 1 deletion _vendors/oneplus.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name: OnePlus
manufacturer:
- oneplus
layout: vendor
award: 4
position: 2
redirect_from: /vendors/oneplus.html
Expand Down
1 change: 0 additions & 1 deletion _vendors/samsung.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name: Samsung
manufacturer:
- samsung
layout: vendor
award: 2
position: 7
redirect_from: /vendors/samsung.html
Expand Down
1 change: 0 additions & 1 deletion _vendors/sony.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name: Sony
manufacturer:
- sony
layout: vendor
award: 3
position: 6
redirect_from: /vendors/sony.html
Expand Down
1 change: 0 additions & 1 deletion _vendors/stock_android.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name: Google (Pixel, Nexus)
manufacturer:
- google
layout: vendor
award: 1
position: 9
redirect_from: /vendors/stock_android.html
Expand Down
1 change: 0 additions & 1 deletion _vendors/xiaomi.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name: Xiaomi
manufacturer:
- xiaomi
layout: vendor
position: 3
award: 3
redirect_from: /vendors/xiaomi.html
Expand Down
23 changes: 23 additions & 0 deletions output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
limit: 100
---
{"vendors": [
{% assign sorted_vendors = site.vendors | sort: "award" | reverse %}
{% for vendor in sorted_vendors limit: page.limit %}
{
"name": {{ vendor.name | jsonify }},
"manufacturer": [{% for v in vendor.manufacturer %}"{{ v }}"{% unless forloop.last %},{% endunless %}{% endfor %}],
"url": {{ vendor.url | jsonify }},
"award": {{ vendor.award | jsonify }},
"position": {{ vendor.position | jsonify }},
"explanation": {{ vendor.explanation | markdownify | replace: 'src="/assets/img/',
'src="https://dontkillmyapp.com/assets/img/' | jsonify }},
"user_solution": {{ vendor.user_solution | markdownify | replace: 'src="/assets/img/',
'src="https://dontkillmyapp.com/assets/img/' | jsonify }},
"developer_solution": {{ vendor.developer_solution | markdownify | replace: 'src="/assets/img/',
'src="https://dontkillmyapp.com/assets/img/' | jsonify }}
}
{% unless forloop.last %},{% endunless %}
{% endfor %}
]
}

0 comments on commit a11a44d

Please sign in to comment.