-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use local version of brut * Update page template variables * Define a notes collection This also migrates publishDate to published_date * Replace processNote buildScript with a processContext function The bulk of the diff is removing the buildScript from frontmatter in all notes * Replace getNotesLastFive buildScript by context preprocessing and mustache section * Replace getNotes buildScript by a mustache section * Remove unused deps * Bump brut
- Loading branch information
1 parent
1b9cb35
commit 84e149e
Showing
222 changed files
with
1,312 additions
and
2,444 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,23 @@ | ||
export default {}; | ||
export default { | ||
collections: ["notes"], | ||
processContext: (context) => { | ||
const notesWithFormattedDate = context.notes.map((note) => { | ||
const formattedDate = new Date( | ||
note.frontmatter.published_date | ||
).toLocaleDateString("en-US", { | ||
weekday: "long", | ||
year: "numeric", | ||
month: "long", | ||
day: "numeric", | ||
}); | ||
// add the formatted date under frontmatter as published_date_string | ||
// we keep published_date because we need it for the HTML time element's datetime attribute | ||
note.frontmatter.published_date_string = formattedDate; | ||
return note; | ||
}); | ||
const notesLastTen = notesWithFormattedDate.slice(0, 10); | ||
context.notes = notesWithFormattedDate; | ||
context.notes_last_ten = notesLastTen; | ||
return context; | ||
}, | ||
}; |
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,7 +1,6 @@ | ||
--- | ||
title: "Garden" | ||
template: page | ||
buildScript: "/scripts/processNote.js" | ||
--- | ||
|
||
# Web | ||
|
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
Oops, something went wrong.