Commit
+20 -5 +/-3 browse
1 | diff --git a/content/projects/air-quality-torino/README.md b/content/projects/air-quality-torino/README.md |
2 | index 2306a92..abcfb8c 100644 |
3 | --- a/content/projects/air-quality-torino/README.md |
4 | +++ b/content/projects/air-quality-torino/README.md |
5 | @@ -22,19 +22,19 @@ neighborhood of Torino, Italy. |
6 | | PM2,5 | 0–10 μg/m³ | 10–20 μg/m³ | 20–25 μg/m³ | 25–50 μg/m³ | 50–75 μg/m³ | 75–800 μg/m³ | |
7 | | PM10 | 0–20 μg/m³ | 20–40 μg/m³ | 40–50 μg/m³ | 50–100 μg/m³ | 100–150 μg/m³ | 150–1200 μg/m³ | |
8 | |
9 | - <img src="http://127.0.0.1:8142/chart.svg?query=%7B__name__%3D~%22airgradient_(pm1_ugm3%7Cpm2d5_ugm3%7Cpm10_ugm3)%22%7D&label=%7B%7B.__name__%7D%7D&width=8&height=3&background-color=%23333333&foreground-color=%23e4e4e4&title=Particulates" /> |
10 | + <img src="{{ variables.torino_air.particulates_url }}" /> |
11 | |
12 | ### Nitrous Oxide (NOx) |
13 | |
14 | - <img src="http://127.0.0.1:8142/chart.svg?query=airgradient_nox_raw&label=%7B%7B.__name__%7D%7D&width=8&height=3&background-color=%23333333&foreground-color=%23e4e4e4&title=NOx" /> |
15 | + <img src="{{ variables.torino_air.nox_url }}" /> |
16 | |
17 | ### CO2 |
18 | |
19 | - <img src="http://127.0.0.1:8142/chart.svg?query=airgradient_co2_ppm&label=%7B%7B.__name__%7D%7D&width=8&height=3&background-color=%23333333&foreground-color=%23e4e4e4&title=CO2" /> |
20 | + <img src="{{ variables.torino_air.co2_url | safe }}" /> |
21 | |
22 | ### Temperature & Humidity |
23 | |
24 | - <img src="http://127.0.0.1:8142/chart.svg?query=%7B__name__%3D~%22(airgradient_humidity_percent%7Cairgradient_temperature_celsius)%22%7D&width=8&height=3&label=%7B%7B.__name__%7D%7D&background-color=%23333333&foreground-color=%23e4e4e4&min=0&title=Temperature" /> |
25 | + <img src="{{ variables.torino_air.temperature_url | safe }}" /> |
26 | |
27 | |
28 | <h2 id="ref"> Refs </h2> |
29 | diff --git a/render.py b/render.py |
30 | index 216798e..835b254 100755 |
31 | --- a/render.py |
32 | +++ b/render.py |
33 | @@ -22,6 +22,10 @@ def _load_sitemap(path, current_path): |
34 | if not _sitemap["enabled"]: |
35 | return None |
36 | |
37 | + variables = dict() |
38 | + if "variables" in _sitemap: |
39 | + variables = _sitemap["variables"] |
40 | + |
41 | def _filter_entries(entries): |
42 | entries = list( |
43 | filter( |
44 | @@ -63,7 +67,7 @@ def _load_sitemap(path, current_path): |
45 | entry["url"] = target |
46 | by_name[target] = entry |
47 | |
48 | - return dict(by_name=by_name, links=entries) |
49 | + return dict(by_name=by_name, variables=variables, links=entries) |
50 | |
51 | |
52 | def _make_tree(links): |
53 | @@ -121,8 +125,10 @@ def generate(template, content_path, stylesheet, link, sitemap, devmode=False): |
54 | { |
55 | "sitemap": sitemap, |
56 | "tree": tree, |
57 | + "variables": sitemap["variables"] |
58 | } |
59 | ), |
60 | + "variables": sitemap["variables"], |
61 | "is_index": False, |
62 | "link": link, |
63 | "style": style, |
64 | diff --git a/sitemap.yaml b/sitemap.yaml |
65 | index 07d9bdc..d31a589 100644 |
66 | --- a/sitemap.yaml |
67 | +++ b/sitemap.yaml |
68 | @@ -1,4 +1,13 @@ |
69 | enabled: true |
70 | + # global variables exposed everywhere |
71 | + variables: |
72 | + # urls served by charts.ayllu-forge.org |
73 | + torino_air: |
74 | + particulates_url: "https://charts.ayllu-forge.org/chart.svg?query=%7B__name__%3D~%22airgradient_(pm1_ugm3%7Cpm2d5_ugm3%7Cpm10_ugm3)%22%7D&label=%7B%7B.__name__%7D%7D&width=8&height=3&background-color=%23333333&foreground-color=%23e4e4e4&title=Particulates" |
75 | + nox_url: "https://charts.ayllu-forge.org/chart.svg?query=airgradient_nox_raw&label=%7B%7B.__name__%7D%7D&width=8&height=3&background-color=%23333333&foreground-color=%23e4e4e4&title=NOx" |
76 | + co2_url: "https://charts.ayllu-forge.org/chart.svg?query=airgradient_co2_ppm&label=%7B%7B.__name__%7D%7D&width=8&height=3&background-color=%23333333&foreground-color=%23e4e4e4&title=CO2" |
77 | + temperature_url: "https://charts.ayllu-forge.org/chart.svg?query=%7B__name__%3D~%22(airgradient_humidity_percent%7Cairgradient_temperature_celsius)%22%7D&width=8&height=3&label=%7B%7B.__name__%7D%7D&background-color=%23333333&foreground-color=%23e4e4e4&min=0&title=Temperature" |
78 | + |
79 | entries: |
80 | - name: blog |
81 | enabled: true |