Adds https://github.com/11ty/eleventy/issues/386 to default eleventy-base-blog config

master
Zach Leatherman 2019-01-31 07:14:06 -06:00
parent d0c924e963
commit e2be85925d
1 changed files with 15 additions and 0 deletions

View File

@ -1,4 +1,5 @@
const { DateTime } = require("luxon");
const fs = require("fs");
const pluginRss = require("@11ty/eleventy-plugin-rss");
const pluginSyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
@ -50,6 +51,20 @@ module.exports = function(eleventyConfig) {
.use(markdownItAnchor, opts)
);
eleventyConfig.setBrowserSyncConfig({
callbacks: {
ready: function(err, browserSync) {
const content_404 = fs.readFileSync('_site/404.html');
browserSync.addMiddleware("*", (req, res) => {
// Provides the 404 content without redirect.
res.write(content_404);
res.end();
});
}
}
});
return {
templateFormats: [
"md",