Using deep data merge (post tag is inherited from posts/posts.json) and updates to use 0.7.0.
This commit is contained in:
18
.eleventy.js
18
.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");
|
||||
|
||||
Reference in New Issue
Block a user