From d5a16cbd47a519abdf14a8bc0d41ce6227094a90 Mon Sep 17 00:00:00 2001 From: Cassey Lottman Date: Tue, 4 Jun 2019 11:48:38 -0500 Subject: [PATCH 1/7] use tagList with full filter instead of just excluding posts --- _includes/postslist.njk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -%} From b6e0b85a876da6ce880d02573e93b63d529a4b59 Mon Sep 17 00:00:00 2001 From: Cassey Lottman Date: Tue, 18 Jun 2019 10:22:58 -0500 Subject: [PATCH 2/7] run browsersync in ghost mode The average user probably does not want every reader's scroll position synced to every other reader. --- .eleventy.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.eleventy.js b/.eleventy.js index 1d3dbc1..bb11631 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -61,7 +61,12 @@ module.exports = function(eleventyConfig) { res.write(content_404); res.end(); }); - } + }, + ghostMode: { + clicks: false, + forms: false, + scroll: false, + }, } }); From a9f9d1bc96e514d8a8c73f1c19ede3dcd755b9e5 Mon Sep 17 00:00:00 2001 From: Ben Edwards Date: Tue, 23 Jul 2019 18:00:11 +0100 Subject: [PATCH 3/7] Builds feed URL from site URL to reduce replication --- _data/metadata.json | 1 - feed/feed.njk | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 _data/metadata.json mode change 100644 => 100755 feed/feed.njk 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/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 }} From c9018fa45bfde4f684f7de5b70673f47912672de Mon Sep 17 00:00:00 2001 From: Zach Leatherman Date: Mon, 11 Nov 2019 15:39:48 -0600 Subject: [PATCH 4/7] Use `eleventy-navigation` plugin for navigation menu --- .eleventy.js | 2 ++ _includes/layouts/base.njk | 12 +++++++----- about/index.md | 6 +++--- archive.njk | 6 +++--- index.njk | 6 +++--- package.json | 2 ++ 6 files changed, 20 insertions(+), 14 deletions(-) diff --git a/.eleventy.js b/.eleventy.js index 1d3dbc1..5c7fdd4 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -2,10 +2,12 @@ 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"); module.exports = function(eleventyConfig) { eleventyConfig.addPlugin(pluginRss); eleventyConfig.addPlugin(pluginSyntaxHighlight); + eleventyConfig.addPlugin(pluginNavigation); eleventyConfig.setDataDeepMerge(true); eleventyConfig.addLayoutAlias("post", "layouts/post.njk"); diff --git a/_includes/layouts/base.njk b/_includes/layouts/base.njk index 85c274b..e144570 100644 --- a/_includes/layouts/base.njk +++ b/_includes/layouts/base.njk @@ -12,11 +12,13 @@

{{ metadata.title }}

- + + {{ collections.all | eleventyNavigation | eleventyNavigationToHtml({ + listClass: "nav", + listItemClass: "nav-item", + activeListItemClass: "nav-item-active", + activeKey: eleventyNavigation.key + }) | safe }}
diff --git a/about/index.md b/about/index.md index 4ccc204..56eb2c5 100644 --- a/about/index.md +++ b/about/index.md @@ -1,9 +1,9 @@ --- layout: layouts/post.njk title: About Me -tags: - - nav -navtitle: About +eleventyNavigation: + key: About Me + order: 2 templateClass: tmpl-post --- diff --git a/archive.njk b/archive.njk index 61c48d9..5dbd42e 100644 --- a/archive.njk +++ b/archive.njk @@ -1,8 +1,8 @@ --- layout: layouts/home.njk -tags: - - nav -navtitle: Archive +eleventyNavigation: + key: Archive + order: 3 permalink: /posts/ --- 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 f88d030..ac0c313 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "scripts": { "build": "npx eleventy", "watch": "npx eleventy --watch", + "serve": "npx eleventy --serve", "debug": "DEBUG=* npx eleventy" }, "repository": { @@ -23,6 +24,7 @@ "homepage": "https://github.com/11ty/eleventy-base-blog#readme", "devDependencies": { "@11ty/eleventy": "^0.9.0", + "@11ty/eleventy-navigation": "^0.1.0", "@11ty/eleventy-plugin-rss": "^1.0.7", "@11ty/eleventy-plugin-syntaxhighlight": "^2.0.3", "luxon": "^1.12.0", From 93e23c7885565c3c884cbb505a9aaab8bf1c2c7e Mon Sep 17 00:00:00 2001 From: Zach Leatherman Date: Mon, 11 Nov 2019 16:22:08 -0600 Subject: [PATCH 5/7] Navigation plugin needs to work with pathprefix (update dep) --- .eleventy.js | 32 +++++++++++++++++--------------- _includes/layouts/base.njk | 3 ++- about/index.md | 2 +- archive.njk | 2 +- package.json | 2 +- 5 files changed, 22 insertions(+), 19 deletions(-) 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 @@

{{ metadata.title }}

- + + {#- Read more about `eleventy-navigation` at https://github.com/11ty/eleventy-navigation #} {{ collections.all | eleventyNavigation | eleventyNavigationToHtml({ listClass: "nav", listItemClass: "nav-item", diff --git a/about/index.md b/about/index.md index 56eb2c5..95f70a4 100644 --- a/about/index.md +++ b/about/index.md @@ -1,10 +1,10 @@ --- layout: layouts/post.njk title: About Me +templateClass: tmpl-post eleventyNavigation: key: About Me order: 2 -templateClass: tmpl-post --- I am a person that writes stuff. diff --git a/archive.njk b/archive.njk index 5dbd42e..232f770 100644 --- a/archive.njk +++ b/archive.njk @@ -1,9 +1,9 @@ --- layout: layouts/home.njk +permalink: /posts/ eleventyNavigation: key: Archive order: 3 -permalink: /posts/ ---

Archive

diff --git a/package.json b/package.json index ac0c313..e78baf3 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "homepage": "https://github.com/11ty/eleventy-base-blog#readme", "devDependencies": { "@11ty/eleventy": "^0.9.0", - "@11ty/eleventy-navigation": "^0.1.0", + "@11ty/eleventy-navigation": "^0.1.1", "@11ty/eleventy-plugin-rss": "^1.0.7", "@11ty/eleventy-plugin-syntaxhighlight": "^2.0.3", "luxon": "^1.12.0", From f870ecd50c94b5845051007787b9d05be65a55c3 Mon Sep 17 00:00:00 2001 From: Zach Leatherman Date: Thu, 2 Jan 2020 20:51:47 -0600 Subject: [PATCH 6/7] Switches to use more obvious markup menu template for eleventy-navigation --- .eleventy.js | 3 ++- _includes/layouts/base.njk | 15 +++++++-------- about/index.md | 2 +- archive.njk | 2 +- package.json | 8 ++++---- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.eleventy.js b/.eleventy.js index 2eadfa6..adb44cd 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -78,8 +78,9 @@ module.exports = function(eleventyConfig) { // If you don’t have a subdirectory, use "" or "/" (they do the same thing) // 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` + // 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", diff --git a/_includes/layouts/base.njk b/_includes/layouts/base.njk index 8866888..41be5c1 100644 --- a/_includes/layouts/base.njk +++ b/_includes/layouts/base.njk @@ -13,20 +13,19 @@

{{ metadata.title }}

- {#- Read more about `eleventy-navigation` at https://github.com/11ty/eleventy-navigation #} - {{ collections.all | eleventyNavigation | eleventyNavigationToHtml({ - listClass: "nav", - listItemClass: "nav-item", - activeListItemClass: "nav-item-active", - activeKey: eleventyNavigation.key - }) | safe }} + {#- Read more about `eleventy-navigation` at https://www.11ty.dev/docs/plugins/navigation/ #} +
  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/about/index.md b/about/index.md index 95f70a4..c74e8ba 100644 --- a/about/index.md +++ b/about/index.md @@ -4,7 +4,7 @@ title: About Me templateClass: tmpl-post eleventyNavigation: key: About Me - order: 2 + order: 3 --- I am a person that writes stuff. diff --git a/archive.njk b/archive.njk index 232f770..0b277a8 100644 --- a/archive.njk +++ b/archive.njk @@ -3,7 +3,7 @@ layout: layouts/home.njk permalink: /posts/ eleventyNavigation: key: Archive - order: 3 + order: 2 ---

Archive

diff --git a/package.json b/package.json index e78baf3..ac2a0e9 100644 --- a/package.json +++ b/package.json @@ -24,11 +24,11 @@ "homepage": "https://github.com/11ty/eleventy-base-blog#readme", "devDependencies": { "@11ty/eleventy": "^0.9.0", - "@11ty/eleventy-navigation": "^0.1.1", + "@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" } } From f29dcf410f3cc27180d965b0393c48976a965e57 Mon Sep 17 00:00:00 2001 From: Zach Leatherman Date: Thu, 2 Jan 2020 20:52:10 -0600 Subject: [PATCH 7/7] v5.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ac2a0e9..21b207b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "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": "npx eleventy",