Added cachebusting

This commit is contained in:
Marcus Noble 2016-05-27 07:02:17 +01:00
parent 00ec71b928
commit 106004ce62
4 changed files with 6 additions and 4 deletions

4
app.js
View File

@ -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/*',

View File

@ -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",

View File

@ -8,7 +8,7 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/milligram/1.1.0/milligram.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/styles/zenburn.min.css">
<link rel="stylesheet" href="/css/main.css">
<link rel="stylesheet" href="/css/main.css?{{moment date 'YYYYMMDDHHMM'}}">
<link rel="canonical" href="{{ site.url }}">
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ site.url }}/feed.xml">
</head>

View File

@ -13,7 +13,7 @@
<section class="header">
<div id="logo">
<img src="/images/marcus.jpg" />
<img src="/images/marcus.jpg?{{moment date 'YYYYMMDDHHMM'}}" />
<h1>Marcus Noble</h1>
</div>
</section>