diff --git a/.eleventy.js b/.eleventy.js index 1d3dbc1..1cd30f8 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -2,10 +2,15 @@ const { DateTime } = require("luxon"); 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"); @@ -33,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) { @@ -61,7 +61,12 @@ module.exports = function(eleventyConfig) { res.write(content_404); res.end(); }); - } + }, + ghostMode: { + clicks: false, + forms: false, + scroll: false, + }, } }); @@ -74,15 +79,20 @@ 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) + // Best paired with the `url` filter: https://www.11ty.io/docs/filters/url/ + + // 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/_data/metadata.json b/_data/metadata.json old mode 100644 new mode 100755 index 9fb34c4..8d2a754 --- a/_data/metadata.json +++ b/_data/metadata.json @@ -6,7 +6,6 @@ "subtitle": "I am writing about my experiences as a naval navel-gazer.", "filename": "feed.xml", "path": "/feed/feed.xml", - "url": "https://myurl.com/feed/feed.xml", "id": "https://myurl.com/" }, "author": { diff --git a/_includes/layouts/base.njk b/_includes/layouts/base.njk index 85c274b..41be5c1 100644 --- a/_includes/layouts/base.njk +++ b/_includes/layouts/base.njk @@ -12,10 +12,12 @@

{{ metadata.title }}

+ + {#- Read more about `eleventy-navigation` at https://www.11ty.dev/docs/plugins/navigation/ #}
@@ -23,7 +25,7 @@
  1. Edit the _data/metadata.json with your blog’s information.
  2. -
  3. (Optional) Edit .eleventy.js with your configuration preferences.
  4. +
  5. (Optional) Edit .eleventy.js with your [configuration preferences](https://www.11ty.dev/docs/config/).
  6. Delete this message from _includes/layouts/base.njk.

This is an Eleventy project created from the eleventy-base-blog repo.

diff --git a/_includes/postslist.njk b/_includes/postslist.njk index 7eb213e..b9517f4 100644 --- a/_includes/postslist.njk +++ b/_includes/postslist.njk @@ -4,7 +4,7 @@ {% if post.data.title %}{{ post.data.title }}{% else %}{{ post.url }}{% endif %} {% for tag in post.data.tags %} - {%- if tag != "posts" -%} + {%- if collections.tagList.indexOf(tag) != -1 -%} {% set tagUrl %}/tags/{{ tag }}/{% endset %} {{ tag }} {%- endif -%} diff --git a/about/index.md b/about/index.md index 4ccc204..c74e8ba 100644 --- a/about/index.md +++ b/about/index.md @@ -1,10 +1,10 @@ --- layout: layouts/post.njk title: About Me -tags: - - nav -navtitle: About templateClass: tmpl-post +eleventyNavigation: + key: About Me + order: 3 --- I am a person that writes stuff. diff --git a/archive.njk b/archive.njk index 61c48d9..0b277a8 100644 --- a/archive.njk +++ b/archive.njk @@ -1,9 +1,9 @@ --- layout: layouts/home.njk -tags: - - nav -navtitle: Archive permalink: /posts/ +eleventyNavigation: + key: Archive + order: 2 ---

Archive

diff --git a/feed/feed.njk b/feed/feed.njk old mode 100644 new mode 100755 index 5711fe1..eec5022 --- a/feed/feed.njk +++ b/feed/feed.njk @@ -6,7 +6,8 @@ eleventyExcludeFromCollections: true {{ metadata.title }} {{ metadata.feed.subtitle }} - + {% set absoluteUrl %}{{ metadata.feed.path | url | absoluteUrl(metadata.url) }}{% endset %} + {{ collections.posts | rssLastUpdatedDate }} {{ metadata.feed.id }} diff --git a/index.njk b/index.njk index 24ca51c..69b53ab 100644 --- a/index.njk +++ b/index.njk @@ -1,8 +1,8 @@ --- layout: layouts/home.njk -tags: - - nav -navtitle: Home +eleventyNavigation: + key: Home + order: 1 ---

Latest 3 Posts

diff --git a/package.json b/package.json index a88a406..6b67f3e 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,11 @@ { "name": "eleventy-base-blog", - "version": "5.0.0", + "version": "5.0.1", "description": "A starter repository for a blog web site using the Eleventy static site generator.", "scripts": { "build": "eleventy", "watch": "eleventy --watch", + "serve": "eleventy --serve", "debug": "DEBUG=* eleventy" }, "repository": { @@ -23,10 +24,11 @@ "homepage": "https://github.com/11ty/eleventy-base-blog#readme", "devDependencies": { "@11ty/eleventy": "^0.9.0", + "@11ty/eleventy-navigation": "^0.1.3", "@11ty/eleventy-plugin-rss": "^1.0.7", - "@11ty/eleventy-plugin-syntaxhighlight": "^2.0.3", - "luxon": "^1.12.0", + "@11ty/eleventy-plugin-syntaxhighlight": "^3.0.0", + "luxon": "^1.21.3", "markdown-it": "^8.4.2", - "markdown-it-anchor": "^5.0.2" + "markdown-it-anchor": "^5.2.5" } }