diff --git a/.eleventy.js b/.eleventy.js index bfda7a6..fa65db0 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -5,6 +5,7 @@ const pluginSyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight"); module.exports = function(eleventyConfig) { eleventyConfig.addPlugin(pluginRss); eleventyConfig.addPlugin(pluginSyntaxHighlight); + eleventyConfig.setDataDeepMerge(true); eleventyConfig.addLayoutAlias("post", "layouts/post.njk"); @@ -12,6 +13,11 @@ module.exports = function(eleventyConfig) { return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat("dd LLL yyyy"); }); + // https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string + eleventyConfig.addFilter('htmlDateString', (dateObj) => { + return DateTime.fromJSDate(dateObj).toFormat('yyyy-LL-dd'); + }); + // Get the first `n` elements of a collection. eleventyConfig.addFilter("head", (array, n) => { if( n < 0 ) { @@ -21,18 +27,6 @@ module.exports = function(eleventyConfig) { return array.slice(0, n); }); - // https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string - eleventyConfig.addFilter('htmlDateString', (dateObj) => { - return DateTime.fromJSDate(dateObj).toFormat('yyyy-LL-dd'); - }); - - // only content in the `posts/` directory - eleventyConfig.addCollection("posts", function(collection) { - return collection.getFilteredByGlob("./posts/*").sort(function(a, b) { - return a.date - b.date; - }); - }); - eleventyConfig.addCollection("tagList", require("./_11ty/getTagList")); eleventyConfig.addPassthroughCopy("img"); diff --git a/_11ty/getTagList.js b/_11ty/getTagList.js index 1b7be79..45a7def 100644 --- a/_11ty/getTagList.js +++ b/_11ty/getTagList.js @@ -1,11 +1,8 @@ module.exports = function(collection) { let tagSet = new Set(); - collection.getAllSorted().forEach(function(item) { + collection.getAll().forEach(function(item) { if( "tags" in item.data ) { let tags = item.data.tags; - if( typeof tags === "string" ) { - tags = [tags]; - } tags = tags.filter(function(item) { switch(item) { diff --git a/_data/metadata.json b/_data/metadata.json index 415d5e7..9fb34c4 100644 --- a/_data/metadata.json +++ b/_data/metadata.json @@ -1,6 +1,7 @@ { "title": "Your Blog Name", "url": "https://myurl.com/", + "description": "I am writing about my experiences as a naval navel-gazer.", "feed": { "subtitle": "I am writing about my experiences as a naval navel-gazer.", "filename": "feed.xml", diff --git a/_includes/layouts/base.njk b/_includes/layouts/base.njk index 1bdf33e..85c274b 100644 --- a/_includes/layouts/base.njk +++ b/_includes/layouts/base.njk @@ -1,38 +1,39 @@ - - - - {{ renderData.title or title or metadata.title }} - - - - - -
-

{{ metadata.title }}

- -
+ + + + {{ renderData.title or title or metadata.title }} + + + + + + +
+

{{ metadata.title }}

+ +
- -
-
    -
  1. Edit the _data/metadata.json with your blog’s information.
  2. -
  3. (Optional) Edit .eleventy.js with your configuration preferences.
  4. -
  5. Delete this message from _includes/layouts/base.njk.
  6. -
-

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

-
+ +
+
    +
  1. Edit the _data/metadata.json with your blog’s information.
  2. +
  3. (Optional) Edit .eleventy.js with your configuration preferences.
  4. +
  5. Delete this message from _includes/layouts/base.njk.
  6. +
+

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

+
- {{ content | safe }} - + {{ content | safe }} + -
+
- - + + diff --git a/_includes/postslist.njk b/_includes/postslist.njk index 3dd0c49..7eb213e 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 != "post" -%} + {%- if tag != "posts" -%} {% set tagUrl %}/tags/{{ tag }}/{% endset %} {{ tag }} {%- endif -%} diff --git a/package.json b/package.json index 5ae1844..c778369 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ }, "homepage": "https://github.com/11ty/eleventy-base-blog#readme", "devDependencies": { - "@11ty/eleventy": "^0.5.4", + "@11ty/eleventy": "^0.7.0", "@11ty/eleventy-plugin-rss": "^1.0.3", "@11ty/eleventy-plugin-syntaxhighlight": "^2.0.0", "luxon": "^1.0.0", diff --git a/posts/firstpost.md b/posts/firstpost.md index 666a29a..0fc8a78 100644 --- a/posts/firstpost.md +++ b/posts/firstpost.md @@ -1,8 +1,8 @@ --- title: This is my first post. +description: This is a post on My Blog about agile frameworks. date: 2018-05-01 tags: - - post - another-tag layout: layouts/post.njk --- diff --git a/posts/fourthpost.md b/posts/fourthpost.md index 9107bcf..4f11fd4 100644 --- a/posts/fourthpost.md +++ b/posts/fourthpost.md @@ -1,5 +1,6 @@ --- title: This is my fourth post. +description: This is a post on My Blog about touchpoints and circling wagons. date: 2018-09-30 tags: second-tag layout: layouts/post.njk diff --git a/posts/posts.json b/posts/posts.json new file mode 100644 index 0000000..17f25d5 --- /dev/null +++ b/posts/posts.json @@ -0,0 +1,5 @@ +{ + "tags": [ + "posts" + ] +} diff --git a/posts/secondpost.md b/posts/secondpost.md index bee6fcc..f9ecade 100644 --- a/posts/secondpost.md +++ b/posts/secondpost.md @@ -1,8 +1,8 @@ --- title: This is my second post. +description: This is a post on My Blog about leveraging agile frameworks. date: 2018-07-04 tags: - - post - number-2 layout: layouts/post.njk --- diff --git a/posts/thirdpost.md b/posts/thirdpost.md index 6688b55..fb8c056 100644 --- a/posts/thirdpost.md +++ b/posts/thirdpost.md @@ -1,8 +1,8 @@ --- title: This is my third post. +description: This is a post on My Blog about win-win survival strategies. date: 2018-08-24 tags: - - post - second-tag layout: layouts/post.njk ---