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

This commit is contained in:
Zach Leatherman 2019-01-31 07:14:06 -06:00
parent d0c924e963
commit e2be85925d

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