Преглед на файлове

Start moving to page bundles

master
Chris Smith преди 4 години
родител
ревизия
68392ca374
Signed by: Chris Smith <chris@chameth.com> GPG Key ID: 3A2D4BBDC4A3C9A9

+ 11
- 0
nginx.conf Целия файл

@@ -50,10 +50,21 @@ http {
50 50
         "~*webp"  ".webp";
51 51
     }
52 52
 
53
+    map $request_uri $redirect_uri {
54
+        /res/images/sense/sense.jpg             /2016/04/10/sense-api/sense.jpg;
55
+        /res/images/wemo/switch.jpg             /2016/05/02/monitoring-power-with-wemo/switch.jpg
56
+        /res/images/wemo/desk-1d.png            /2016/05/02/monitoring-power-with-wemo/desk-1d.png
57
+        /res/images/wemo/desk-1w.png            /2016/05/02/monitoring-power-with-wemo/desk-1w.png
58
+    }
59
+
53 60
     server {
54 61
         listen       80;
55 62
         server_name  chameth.com localhost;
56 63
 
64
+        if ( $redirect_uri ) {
65
+            return 301 $redirect_uri;
66
+        }
67
+
57 68
         location / {
58 69
             root   /usr/share/nginx/html;
59 70
             index  index.html index.htm;

site/content/post/2016-04-10-sense-api.md → site/content/post/2016-04-10-sense-api/index.md Целия файл

@@ -1,19 +1,20 @@
1 1
 ---
2 2
 date: 2016-04-10
3
-strapline: Who needs API docs when you can do a MITM attack?
4
-thumbnail: /res/images/sense/sense.thumb.jpg
5 3
 title: Reverse engineering the Sense API
6
-url: /2016/04/10/sense-api/
7
-aliases: ["/2016/04/10/sense-api.html"]
8
-image: /res/images/sense/sense.jpg
9 4
 description: How to retrieve data from a Hello Sense without using the official apps.
10 5
 area: REST APIs
6
+url: /2016/04/10/sense-api/
7
+aliases: ["/2016/04/10/sense-api.html"]
8
+
9
+resources:
10
+  - src: sense.jpg
11
+    name: A Sense unit and its two pillow sensors
12
+    title: A Sense unit and its two pillow sensors
13
+    params:
14
+      default: true
11 15
 ---
12 16
 
13
-<figure class="right">
14
-  <img src="/res/images/sense/sense.jpg" alt="Sense">
15
-  <figcaption>A Sense unit and its two pillow sensors</figcaption>
16
-</figure>
17
+{{< figure "right" "A Sense unit and its two pillow sensors" >}}
17 18
 
18 19
 Sense is a little device that sits by your bedside and, in
19 20
 conjunction with a little 'pill' attached to your pillow, monitors your sleeping patterns and

site/static/res/images/sense/sense.jpg → site/content/post/2016-04-10-sense-api/sense.jpg Целия файл


site/static/res/images/wemo/desk-1d.png → site/content/post/2016-05-02-monitoring-power-with-wemo/desk-1d.png Целия файл


site/static/res/images/wemo/desk-1w.png → site/content/post/2016-05-02-monitoring-power-with-wemo/desk-1w.png Целия файл


site/content/post/2016-05-02-monitoring-power-with-wemo.md → site/content/post/2016-05-02-monitoring-power-with-wemo/index.md Целия файл

@@ -1,19 +1,23 @@
1 1
 ---
2 2
 date: 2016-05-02
3
-strapline: Fun with SOAP and rrdtool
4
-thumbnail: /res/images/wemo/switch.thumb.jpg
5 3
 title: Monitoring power draw with WeMo Insight Switches
6
-url: /2016/05/02/monitoring-power-with-wemo/
7
-aliases: ["/2016/05/02/monitoring-power-with-wemo.html"]
8
-image: /res/images/wemo/desk-1d.png
9 4
 description: Using SOAP requests to get raw data, and rrdtool to produce graphs.
10 5
 area: data analysis
6
+url: /2016/05/02/monitoring-power-with-wemo/
7
+aliases: ["/2016/05/02/monitoring-power-with-wemo.html"]
8
+
9
+resources:
10
+  - src: switch.jpg
11
+    name: A WeMo Insight Switch
12
+    params:
13
+      default: true
14
+  - src: desk-1d.png
15
+    name: Graph of power usage over a day
16
+  - src: desk-1w.png
17
+    name: Graph of power usage over a week
11 18
 ---
12 19
 
13
-<figure class="left">
14
-  <img src="/res/images/wemo/switch.jpg" alt="WeMo Insight Switch">
15
-  <figcaption>A WeMo Insight Switch</figcaption>
16
-</figure>
20
+{{< figure "left" "A WeMo Insight Switch" >}}
17 21
 
18 22
 I recently picked up a couple of <a href="http://www.belkin.com/uk/p/P-F7C029/">Belkin's WeMo
19 23
 Insight Switches</a> to monitor power usage for my PC and networking equipment. WeMo is Belkin's
@@ -190,14 +194,14 @@ The big block of `CDEF`/`CDEF`/`AREA` parameters creates a series of area plots
190 194
 according to the power level. They're in descending order so the smaller areas are drawn on top of
191 195
 the larger layers. This results in a graph that looks like this:
192 196
 
193
-<img src="/res/images/wemo/desk-1d.png" alt="Graph of power usage over a day">
197
+{{< img "Graph of power usage over a day" >}}
194 198
 
195 199
 This graph shows the total power for all the things plugged in at my desk. You can see the idle
196 200
 power draw is around 60W. When I'm using the computer it jumps up to around 130W, and when the
197 201
 computer is under heavy load (playing games, for example) it goes up even further to the 200W mark.
198 202
 With a couple of small tweaks to the rrdtool command, I also have a graph showing the entire week:
199 203
 
200
-<img src="/res/images/wemo/desk-1w.png" alt="Graph of power usage over a week">
204
+{{< img "Graph of power usage over a week" >}}
201 205
 
202 206
 The two huge spikes near the start of the data are caused by a heater under my desk. They're also
203 207
 one of the main reasons I chose to plot the graphs with a logarithmic scale. With a linear scale

site/static/res/images/wemo/switch.jpg → site/content/post/2016-05-02-monitoring-power-with-wemo/switch.jpg Целия файл


+ 7
- 2
site/layouts/partials/head.html Целия файл

@@ -33,9 +33,14 @@
33 33
       {{ if $.Param "description" }}
34 34
         <meta property="og:description" content="{{ $.Param "description" | htmlEscape }}" />
35 35
       {{ end }}
36
-      {{ if $.Param "image" }}
36
+      {{ if $.Param "image" -}}
37 37
         <meta property="og:image" content="{{ $.Param "image" | absURL }}" />
38
-      {{ end }}
38
+      {{- end }}
39
+      {{ range $.Resources.ByType "image" -}}
40
+        {{ if .Params.default }}
41
+          <meta property="og:image" content="{{ .Permalink }}" />
42
+        {{ end }}
43
+      {{- end }}
39 44
     {{ end }}
40 45
   </head>
41 46
   <body id="top">

+ 5
- 0
site/layouts/shortcodes/figure.html Целия файл

@@ -0,0 +1,5 @@
1
+{{ $img := $.Page.Resources.GetMatch (.Get 1) }}
2
+<figure class="{{ .Get 0 }}">
3
+    <img src="{{ $img.RelPermalink }}" alt="{{ $img.Name }}">
4
+    <figcaption>{{ $img.Title }}</figcaption>
5
+</figure>

+ 2
- 0
site/layouts/shortcodes/img.html Целия файл

@@ -0,0 +1,2 @@
1
+{{ $img := $.Page.Resources.GetMatch (.Get 0) }}
2
+<img src="{{ $img.RelPermalink }}" alt="{{ $img.Name }}">

Двоични данни
site/static/res/images/sense/sense.thumb.jpg Целия файл


Двоични данни
site/static/res/images/wemo/switch.thumb.jpg Целия файл


Loading…
Отказ
Запис