summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2015-07-31 20:21:17 (GMT)
committerMonty Taylor <mordred@inaugust.com>2015-08-01 01:49:35 (GMT)
commit39c5c5f4845e0cf415a7ae289370b39f8473db72 (patch)
tree84dd2f0b5406d160114b671dc2e60a33964fb0a4
parent816c90235ed3393b72fc2344457a105971049b5b (diff)
Make layout of posts templated
-rw-r--r--gulpfile.js42
-rw-r--r--package.json2
-rw-r--r--src/posts/big-tent.hbs (renamed from src/posts/big-tent.html)73
-rw-r--r--src/templates/post.hbs66
4 files changed, 112 insertions, 71 deletions
diff --git a/gulpfile.js b/gulpfile.js
index 612ebee..981f289 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -10,6 +10,8 @@
10 var git = require('gulp-git'); 10 var git = require('gulp-git');
11 var filter = require('gulp-filter'); 11 var filter = require('gulp-filter');
12 var less = require('gulp-less'); 12 var less = require('gulp-less');
13 var data = require('gulp-data');
14 var change = require('gulp-change');
13 var rsync = require('gulp-rsync'); 15 var rsync = require('gulp-rsync');
14 var webserver = require('gulp-webserver'); 16 var webserver = require('gulp-webserver');
15 var streamqueue = require('streamqueue'); 17 var streamqueue = require('streamqueue');
@@ -101,8 +103,9 @@
101 var $ = cheerio.load(fs.readFileSync(file)); 103 var $ = cheerio.load(fs.readFileSync(file));
102 posts.push({ 104 posts.push({
103 'title': $("head title").text(), 105 'title': $("head title").text(),
106 'description': $("head meta[name='description']").attr('content'),
104 'mtime': stat.mtime, 107 'mtime': stat.mtime,
105 'path': 'posts/' + files[i] 108 'path': 'posts/' + files[i].replace('.hbs', '.html')
106 }); 109 });
107 } catch (e) { 110 } catch (e) {
108 // Do nothing 111 // Do nothing
@@ -114,6 +117,12 @@
114 return posts; 117 return posts;
115 } 118 }
116 119
120 function performTemplateChange(content) {
121 var file = dir.src + '/templates/post.hbs';
122 var stat = fs.statSync(file);
123 return fs.readFileSync(file, {'encoding': 'utf-8'});
124 }
125
117 /** 126 /**
118 * Clean the output directory. 127 * Clean the output directory.
119 * 128 *
@@ -211,7 +220,7 @@
211 /** 220 /**
212 * Package the handlebars files. 221 * Package the handlebars files.
213 */ 222 */
214 gulp.task('package:posts', function () { 223 gulp.task('package:postindex', function () {
215 224
216 var templateData = { 225 var templateData = {
217 'posts': buildPostManifest(), 226 'posts': buildPostManifest(),
@@ -227,6 +236,30 @@
227 .pipe(gulp.dest(dir.dist)); 236 .pipe(gulp.dest(dir.dist));
228 }); 237 });
229 238
239 gulp.task('package:posts', function () {
240
241 var templateData = {
242 'author': packageJson.author
243 };
244
245 // Automatically build the site list.
246 return gulp.src(dir.src + '/posts/*.hbs', {'base': dir.src})
247 .pipe(data(function(file) {
248 var stat = fs.statSync(file.path);
249 var $ = cheerio.load(fs.readFileSync(file.path));
250 return {
251 'title': $("head title").text(),
252 'description': $("head meta[name='description']").attr('content'),
253 'body': $("body").html(),
254 }}))
255 .pipe(change(performTemplateChange))
256 .pipe(handlebars(templateData, handlebarsConfig))
257 .pipe(rename(function (path) {
258 path.extname = ".html";
259 }))
260 .pipe(gulp.dest(dir.dist));
261 });
262
230 /** 263 /**
231 * Copy the HTML files into the dist folder. 264 * Copy the HTML files into the dist folder.
232 */ 265 */
@@ -295,8 +328,9 @@
295 /** 328 /**
296 * Package the entire site into the dist folder. 329 * Package the entire site into the dist folder.
297 */ 330 */
298 gulp.task('package', ['package:html', 'package:talks', 'package:posts', 331 gulp.task('package', ['package:html', 'package:talks',
299 'package:libs', 332 'package:posts',
333 'package:postindex', 'package:libs',
300 'package:images', 'package:css', 'package:js']); 334 'package:images', 'package:css', 'package:js']);
301 335
302 gulp.task('rsync', function () { 336 gulp.task('rsync', function () {
diff --git a/package.json b/package.json
index de762dc..8346b66 100644
--- a/package.json
+++ b/package.json
@@ -22,7 +22,9 @@
22 "bower": "^1.4.1", 22 "bower": "^1.4.1",
23 "cheerio": "^0.19.0", 23 "cheerio": "^0.19.0",
24 "gulp": "^3.9.0", 24 "gulp": "^3.9.0",
25 "gulp-change": "^1.0.0",
25 "gulp-compile-handlebars": "^0.5.0", 26 "gulp-compile-handlebars": "^0.5.0",
27 "gulp-data": "^1.2.0",
26 "gulp-filter": "^3.0.0", 28 "gulp-filter": "^3.0.0",
27 "gulp-git": "^1.2.4", 29 "gulp-git": "^1.2.4",
28 "gulp-ignore": "^1.2.1", 30 "gulp-ignore": "^1.2.1",
diff --git a/src/posts/big-tent.html b/src/posts/big-tent.hbs
index 8b71e0c..981913a 100644
--- a/src/posts/big-tent.html
+++ b/src/posts/big-tent.hbs
@@ -1,47 +1,9 @@
1<!doctype html> 1<html>
2<html class="no-js"> 2<head>
3 <head> 3 <meta description="OpenStack as Layers but also tents but also cats" />
4 <meta charset="utf-8"> 4 <title> The Big Tent </title>
5 <title>The Big Tent</title> 5</head>
6 <link rel="stylesheet" 6<body>
7 href="/css/bootstrap.css">
8 <link rel="stylesheet"
9 href="/css/mordred.css">
10 <meta name="author" content="{{author.name}}">
11 <meta name="viewport"
12 content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
13 <meta name="description" content="OpenStack as Layers but also tents but also cats">
14 <meta name="viewport" content="width=device-width">
15 <link rel="shortcut icon" href="/favicon.ico">
16
17 </head>
18 <body>
19 <!--[if lt IE 10]>
20 <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
21 <![endif]-->
22
23<nav class="navbar navbar-default navbar-fixed-top">
24 <div class="container-fluid"><a href="/">
25 <span class="navbar-brand">
26 Things you may or may not care or not care about.</a></span>
27 </div>
28</nav>
29
30 <!-- Main jumbotron for a primary marketing message or call to action -->
31 <div class="jumbotron">
32 <div class="container-fluid">
33 <h1>
34 <span xmlns:dct="http://purl.org/dc/terms/"
35 href="http://purl.org/dc/dcmitype/InteractiveResource"
36 property="dct:title"
37 rel="dct:type">
38 The Big Tent
39 </h1>
40 <p class="lead">OpenStack as Layers but also tents but also cats</p>
41 </div>
42 </div>
43
44 <div class="container-fluid">
45 <p>I'd like to build on the ideas in <a href="https://dague.net/2014/08/26/openstack-as-layers/">Sean's Layers</a>. I've been noodling on it for a while and have had a several interesting conversations with people. Before I tell you how I've taxonomied things in my head, I want to spend a second on why.</p> 7 <p>I'd like to build on the ideas in <a href="https://dague.net/2014/08/26/openstack-as-layers/">Sean's Layers</a>. I've been noodling on it for a while and have had a several interesting conversations with people. Before I tell you how I've taxonomied things in my head, I want to spend a second on why.</p>
46 <h3 id="why-do-we-care">Why do we care?</h3> 8 <h3 id="why-do-we-care">Why do we care?</h3>
47 <p>Our choices in organizing our work effect a few different unrelated things:</p> 9 <p>Our choices in organizing our work effect a few different unrelated things:</p>
@@ -223,28 +185,5 @@ designate call-that-ip &#39;blog.inaugust.com&#39; --also-reverse-dns-kthxbai #
223 <p>We can actually let the market decided more on the relative importance of things without us needing to predecide that.</p> 185 <p>We can actually let the market decided more on the relative importance of things without us needing to predecide that.</p>
224 <p>We can take a much stronger position on some of the topics, such as &quot;Compute instances need IP Addresses&quot; without having to put ourselves in the position to take such a strong stance on everything else.</p> 186 <p>We can take a much stronger position on some of the topics, such as &quot;Compute instances need IP Addresses&quot; without having to put ourselves in the position to take such a strong stance on everything else.</p>
225 <p>Who's with me?</p> 187 <p>Who's with me?</p>
226
227 </div>
228
229<nav class="navbar navbar-default navbar-fixed-bottom">
230 <div class="container-fluid">
231 <p class="navbar-text">
232 <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">
233 <img alt="Creative Commons License"
234 src="https://i.creativecommons.org/l/by/4.0/88x31.png"/>
235 </a>
236 <a xmlns:cc="http://creativecommons.org/ns#"
237 rel="cc:attributionURL"
238 href='http://inaugust.com'>http://inaugust.com</a>
239 by <span xmlns:cc="http://creativecommons.org/ns#"
240 property="cc:attributionName">{{author.name}}</span>
241 is licensed under a <a rel="license"
242 href="http://creativecommons.org/licenses/by/4.0/">Creative
243 Commons Attribution 4.0 International License</a>.
244 Source code available at <a href='http://git.inaugust.com/cgit/inaugust.com'>http://git.inaugust.com/cgit/inaugust.com</a>
245 </p>
246 </div>
247</nav>
248
249</body> 188</body>
250</html> 189</html>
diff --git a/src/templates/post.hbs b/src/templates/post.hbs
new file mode 100644
index 0000000..169bd9e
--- /dev/null
+++ b/src/templates/post.hbs
@@ -0,0 +1,66 @@
1<!doctype html>
2<html class="no-js">
3<head>
4 <meta charset="utf-8">
5 <title>{{ title }}</title>
6 <link rel="stylesheet" href="/css/bootstrap.css">
7 <link rel="stylesheet" href="/css/mordred.css">
8 <meta name="author" content="{{author.name}}">
9 <meta name="viewport"
10 content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
11 <meta name="description" content="{{ description }}">
12 <meta name="viewport" content="width=device-width">
13 <link rel="shortcut icon" href="/favicon.ico">
14</head>
15
16<body>
17 <!--[if lt IE 10]>
18 <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
19 <![endif]-->
20
21 <nav class="navbar navbar-default navbar-fixed-top">
22 <div class="container-fluid"><a href="/">
23 <span class="navbar-brand">
24 Things you may or may not care or not care about.</a></span>
25 </div>
26 </nav>
27
28 <div class="jumbotron">
29 <div class="container-fluid">
30 <h1>
31 <span xmlns:dct="http://purl.org/dc/terms/"
32 href="http://purl.org/dc/dcmitype/InteractiveResource"
33 property="dct:title"
34 rel="dct:type">
35 {{ title }}
36 </h1>
37 <p class="lead">{{ description }}</p>
38 </div>
39 </div>
40
41 <div class="container-fluid">
42 {{{ body }}}
43 </div>
44
45 <nav class="navbar navbar-default navbar-bottom">
46 <div class="container-fluid">
47 <p class="navbar-text">
48 <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">
49 <img alt="Creative Commons License"
50 src="https://i.creativecommons.org/l/by/4.0/88x31.png"/>
51 </a>
52 <a xmlns:cc="http://creativecommons.org/ns#"
53 rel="cc:attributionURL"
54 href='http://inaugust.com'>http://inaugust.com</a>
55 by <span xmlns:cc="http://creativecommons.org/ns#"
56 property="cc:attributionName">{{author.name}}</span>
57 is licensed under a <a rel="license"
58 href="http://creativecommons.org/licenses/by/4.0/">Creative
59 Commons Attribution 4.0 International License</a>.
60 Source code available at <a href='http://git.inaugust.com/cgit/inaugust.com'>http://git.inaugust.com/cgit/inaugust.com</a>
61 </p>
62 </div>
63 </nav>
64
65</body>
66</html>