From 106004ce62f50f2f42037451b9f757e42968efc2 Mon Sep 17 00:00:00 2001 From: Marcus Noble Date: Fri, 27 May 2016 07:02:17 +0100 Subject: [PATCH] Added cachebusting --- app.js | 4 +++- package.json | 2 +- templates/partials/head.html | 2 +- templates/partials/header.html | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 554d155..a61d780 100644 --- a/app.js +++ b/app.js @@ -14,6 +14,7 @@ const pagination = require('metalsmith-pagination'); const define = require('metalsmith-define'); const feed = require('metalsmith-feed'); const sass = require('metalsmith-sass'); +const date = require('metalsmith-build-date'); const Handlebars = require('handlebars'); const emoji = require('markdown-it-emoji'); const moment = require('moment'); @@ -22,7 +23,7 @@ const port = process.env.PORT || 8000; const oneDay = 86400000; app.use(compress()); -app.use(express.static(__dirname + '/build', {maxAge: oneDay})); +app.use(express.static(__dirname + '/build', {maxAge: oneDay * 365})); var md = markdown('commonmark', {html: true}); md.parser.use(emoji); @@ -43,6 +44,7 @@ Metalsmith(__dirname) url: 'https://blog.marcusnoble.co.uk' } })) + .use(date()) .use(collections({ posts: { pattern: 'posts/*', diff --git a/package.json b/package.json index 94ce5d5..b4d2600 100644 --- a/package.json +++ b/package.json @@ -8,9 +8,9 @@ "compression": "^1.6.2", "express": "^4.13.4", "handlebars": "^4.0.5", - "imagemin-mozjpeg": "^6.0.0", "markdown-it-emoji": "^1.1.1", "metalsmith": "^2.1.0", + "metalsmith-build-date": "^0.2.0", "metalsmith-collections": "^0.7.0", "metalsmith-define": "^2.0.1", "metalsmith-feed": "^0.2.0", diff --git a/templates/partials/head.html b/templates/partials/head.html index cc54558..cdad86d 100644 --- a/templates/partials/head.html +++ b/templates/partials/head.html @@ -8,7 +8,7 @@ - + \ No newline at end of file diff --git a/templates/partials/header.html b/templates/partials/header.html index a68fd05..3f962f9 100644 --- a/templates/partials/header.html +++ b/templates/partials/header.html @@ -13,7 +13,7 @@
\ No newline at end of file