diff --git a/.eleventy.js b/.eleventy.js index 5c7fdd4..2eadfa6 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -3,11 +3,14 @@ const fs = require("fs"); const pluginRss = require("@11ty/eleventy-plugin-rss"); const pluginSyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight"); const pluginNavigation = require("@11ty/eleventy-navigation"); +const markdownIt = require("markdown-it"); +const markdownItAnchor = require("markdown-it-anchor"); module.exports = function(eleventyConfig) { eleventyConfig.addPlugin(pluginRss); eleventyConfig.addPlugin(pluginSyntaxHighlight); eleventyConfig.addPlugin(pluginNavigation); + eleventyConfig.setDataDeepMerge(true); eleventyConfig.addLayoutAlias("post", "layouts/post.njk"); @@ -35,24 +38,19 @@ module.exports = function(eleventyConfig) { eleventyConfig.addPassthroughCopy("img"); eleventyConfig.addPassthroughCopy("css"); - /* Markdown Plugins */ - let markdownIt = require("markdown-it"); - let markdownItAnchor = require("markdown-it-anchor"); - let options = { + /* Markdown Overrides */ + let markdownLibrary = markdownIt({ html: true, breaks: true, linkify: true - }; - let opts = { + }).use(markdownItAnchor, { permalink: true, permalinkClass: "direct-link", permalinkSymbol: "#" - }; - - eleventyConfig.setLibrary("md", markdownIt(options) - .use(markdownItAnchor, opts) - ); + }); + eleventyConfig.setLibrary("md", markdownLibrary); + // Browsersync Overrides eleventyConfig.setBrowserSyncConfig({ callbacks: { ready: function(err, browserSync) { @@ -76,15 +74,19 @@ module.exports = function(eleventyConfig) { ], // If your site lives in a different subdirectory, change this. - // Leading or trailing slashes are all normalized away, so don’t worry about it. + // Leading or trailing slashes are all normalized away, so don’t worry about those. + // If you don’t have a subdirectory, use "" or "/" (they do the same thing) - // This is only used for URLs (it does not affect your file structure) - pathPrefix: "/", + // This is only used for link URLs (it does not affect your file structure) + // You can also pass this in on the command line using `--pathprefix` + + // pathPrefix: "/", markdownTemplateEngine: "liquid", htmlTemplateEngine: "njk", dataTemplateEngine: "njk", - passthroughFileCopy: true, + + // These are all optional, defaults are shown: dir: { input: ".", includes: "_includes", diff --git a/_includes/layouts/base.njk b/_includes/layouts/base.njk index e144570..8866888 100644 --- a/_includes/layouts/base.njk +++ b/_includes/layouts/base.njk @@ -12,7 +12,8 @@