-
-
Notifications
You must be signed in to change notification settings - Fork 628
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #184 from 11ty/v9
Eleventy Base Blog v9 (using Eleventy v3 and ESM)
- Loading branch information
Showing
36 changed files
with
402 additions
and
431 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
16 | ||
20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { DateTime } from "luxon"; | ||
|
||
export default function(eleventyConfig) { | ||
eleventyConfig.addFilter("readableDate", (dateObj, format, zone) => { | ||
// Formatting tokens for Luxon: https://moment.github.io/luxon/#/formatting?id=table-of-tokens | ||
return DateTime.fromJSDate(dateObj, { zone: zone || "utc" }).toFormat(format || "dd LLLL yyyy"); | ||
}); | ||
|
||
eleventyConfig.addFilter("htmlDateString", (dateObj) => { | ||
// dateObj input: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string | ||
return DateTime.fromJSDate(dateObj, { zone: "utc" }).toFormat('yyyy-LL-dd'); | ||
}); | ||
|
||
// Get the first `n` elements of a collection. | ||
eleventyConfig.addFilter("head", (array, n) => { | ||
if(!Array.isArray(array) || array.length === 0) { | ||
return []; | ||
} | ||
if( n < 0 ) { | ||
return array.slice(n); | ||
} | ||
|
||
return array.slice(0, n); | ||
}); | ||
|
||
// Return the smallest number argument | ||
eleventyConfig.addFilter("min", (...numbers) => { | ||
return Math.min.apply(null, numbers); | ||
}); | ||
|
||
// Return the keys used in an object | ||
eleventyConfig.addFilter("getKeys", target => { | ||
return Object.keys(target); | ||
}); | ||
|
||
eleventyConfig.addFilter("filterTagList", function filterTagList(tags) { | ||
return (tags || []).filter(tag => ["all", "posts"].indexOf(tag) === -1); | ||
}); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { z } from "zod"; | ||
import { fromZodError } from 'zod-validation-error'; | ||
|
||
export default function(data) { | ||
// Draft content, validate `draft` front matter | ||
let result = z.object({ | ||
draft: z.boolean().or(z.undefined()), | ||
}).safeParse(data); | ||
|
||
if(result.error) { | ||
throw fromZodError(result.error); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
---js | ||
const eleventyNavigation = { | ||
key: "About", | ||
order: 3 | ||
}; | ||
--- | ||
# About | ||
|
||
I am a person that writes stuff. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = { | ||
export default { | ||
tags: [ | ||
"posts" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: This is a fifth post (draft) | ||
date: 2023-01-23 | ||
draft: true | ||
---js | ||
const title = "This is a fifth post (draft)"; | ||
const date = "2023-01-23"; | ||
const draft = true; | ||
--- | ||
This is a draft post |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default { | ||
layout: "layouts/home.njk", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
For RSS feed, Atom Feed, and JSON feed templates, see the plugin in eleventy.config.js |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.