From 4f738e38eab0e91b881ce330890bcda9b928ece2 Mon Sep 17 00:00:00 2001 From: Tom Hummel Date: Mon, 30 Jun 2025 22:55:23 -0700 Subject: [PATCH] Switch journal day entries to JSON --- bin/mkdirp-journal-day.mjs | 26 ++++++++++++++++++++++ content/j/2025/06/01/_index.md | 9 ++++++++ content/j/2025/06/01/nomie.json | 3 +++ content/j/2025/06/01/run.json | 4 ++++ content/j/2025/06/01/swarm.json | 8 +++++++ content/j/2025/06/_index.md | 8 +++++++ content/j/2025/_index.md | 8 +++++++ content/j/_index.md | 6 +++++ layouts/j/list.html | 39 +++++++++++++++++++++++++++++++++ 9 files changed, 111 insertions(+) create mode 100755 bin/mkdirp-journal-day.mjs create mode 100644 content/j/2025/06/01/_index.md create mode 100644 content/j/2025/06/01/nomie.json create mode 100644 content/j/2025/06/01/run.json create mode 100644 content/j/2025/06/01/swarm.json create mode 100644 content/j/2025/06/_index.md create mode 100644 content/j/2025/_index.md create mode 100644 content/j/_index.md create mode 100644 layouts/j/list.html diff --git a/bin/mkdirp-journal-day.mjs b/bin/mkdirp-journal-day.mjs new file mode 100755 index 0000000..cbf2578 --- /dev/null +++ b/bin/mkdirp-journal-day.mjs @@ -0,0 +1,26 @@ +#!/usr/bin/env zx + +const day = argv._[1] +if (!day) { + console.error('Usage: mkdirp-journal-day.mjs YYYY-MM-DD') + process.exit(1) +} + +const [y, m, d] = day.split('-') +const dayPath = `./content/j/${y}/${m}/${d}` +await $`mkdir -p ${dayPath}` + +const indexContent = `--- +title: "${day}" +date: ${day}T00:00:00Z +tags: [] +--- + + +` +await $`echo ${indexContent} > ${dayPath}/_index.md` + +// create placeholder JSON data files +await $`echo '{}' > ${dayPath}/run.json` +await $`echo '{}' > ${dayPath}/nomie.json` +await $`echo '{}' > ${dayPath}/swarm.json` diff --git a/content/j/2025/06/01/_index.md b/content/j/2025/06/01/_index.md new file mode 100644 index 0000000..3d5f431 --- /dev/null +++ b/content/j/2025/06/01/_index.md @@ -0,0 +1,9 @@ +--- +title: "2025-06-01" +date: 2025-06-01T00:00:00Z +tags: [] +--- + + + +First journal entry. diff --git a/content/j/2025/06/01/nomie.json b/content/j/2025/06/01/nomie.json new file mode 100644 index 0000000..56b37ab --- /dev/null +++ b/content/j/2025/06/01/nomie.json @@ -0,0 +1,3 @@ +{ + "overall_mood": 4 +} diff --git a/content/j/2025/06/01/run.json b/content/j/2025/06/01/run.json new file mode 100644 index 0000000..311390f --- /dev/null +++ b/content/j/2025/06/01/run.json @@ -0,0 +1,4 @@ +{ + "distance_miles": 5, + "duration_minutes": 40 +} diff --git a/content/j/2025/06/01/swarm.json b/content/j/2025/06/01/swarm.json new file mode 100644 index 0000000..ae1548b --- /dev/null +++ b/content/j/2025/06/01/swarm.json @@ -0,0 +1,8 @@ +{ + "checkins": [ + { + "venue": "Coffee Shop", + "time": "2025-06-01T09:00:00Z" + } + ] +} diff --git a/content/j/2025/06/_index.md b/content/j/2025/06/_index.md new file mode 100644 index 0000000..ae0cf0c --- /dev/null +++ b/content/j/2025/06/_index.md @@ -0,0 +1,8 @@ +--- +title: "June 2025" +date: 2025-06-01 +cascade: + month: 6 +--- + +Entries from June 2025. diff --git a/content/j/2025/_index.md b/content/j/2025/_index.md new file mode 100644 index 0000000..822de19 --- /dev/null +++ b/content/j/2025/_index.md @@ -0,0 +1,8 @@ +--- +title: "2025 Journal" +date: 2025-01-01 +cascade: + year: 2025 +--- + +Journal entries for 2025. diff --git a/content/j/_index.md b/content/j/_index.md new file mode 100644 index 0000000..153950c --- /dev/null +++ b/content/j/_index.md @@ -0,0 +1,6 @@ +--- +title: "Journal" +date: 2025-06-01 +--- + +Personal journal entries organized by date. diff --git a/layouts/j/list.html b/layouts/j/list.html new file mode 100644 index 0000000..ff52049 --- /dev/null +++ b/layouts/j/list.html @@ -0,0 +1,39 @@ +{{ define "main" }} +

{{ .Title }}

+

+ {{ partial "breadcrumb.html" . }} + {{ partial "tag-list.html" . }} +

+ +
{{ .Content }}
+

Total entries: {{ len .RegularPagesRecursive }}

+ +{{ $jsonFiles := .Resources.Match "*.json" }} +{{ if $jsonFiles }} +

Data Files

+ +{{ end }} + +{{ if .Sections }} +

Subsections

+ +{{ end }} + +{{ if .RegularPages }} +

Entries

+ +{{ end }} +{{ end }}