From 5e4612c01dc4082cba4aa8fdd7a7052176eed2da Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 9 May 2026 13:41:00 +0000 Subject: [PATCH] Update post listing tags to use created field throughout Tag names changed from posts-date-*/posts-datetime-* to posts-created-*. Renderer updated to filter, sort, group, and display using the created field from search.json. Page meta display also updated to drop date/datetime fallbacks. Samplesite posts and pages updated to match. https://claude.ai/code/session_013A4egzphocyto9bvZ76dxf --- CLAUDE.md | 4 +-- app/index.html | 31 ++++++++--------------- app/pages/home.md | 16 ++++++------ samplesite/pages/blog.md | 2 +- samplesite/pages/blog.nb.md | 2 +- samplesite/posts/2022-q4-report.md | 3 +-- samplesite/posts/2023-analytics-launch.md | 3 +-- samplesite/posts/2023-security-update.md | 3 +-- samplesite/posts/2024-roadmap.md | 3 +-- samplesite/posts/2024-success-stories.md | 3 +-- samplesite/posts/2026-v9-release.md | 3 +-- 11 files changed, 29 insertions(+), 44 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index d852143..54e60b2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -148,13 +148,13 @@ Embed post lists in pages using fenced blocks: ````markdown ```mdcms -posts-datetime-reversechronological +posts-created-reversechronological limit: 10 paginate: yes ``` ```` -Reliable tags (others are known-broken): `posts-datetime-chronological-byyearmonth`, `posts-datetime-reversechronological`. Use `created` frontmatter (format: `YYYY-MM-DD HH:MM`) for posts. +Reliable tags (others are known-broken): `posts-created-chronological-byyearmonth`, `posts-created-reversechronological`. Use `created` frontmatter (format: `YYYY-MM-DD HH:MM`) for posts. ## Release workflow diff --git a/app/index.html b/app/index.html index a80ba18..d2324f7 100644 --- a/app/index.html +++ b/app/index.html @@ -1369,14 +1369,14 @@ function fmtDatetime(dtStr) { function parsePostTagName(name) { var m = name.match( - /^posts-(date|datetime)-(chronological|reversechronological)(?:-(byyear|byyearmonth|lastyear|lastmonth))?$/ + /^posts-created-(chronological|reversechronological)(?:-(byyear|byyearmonth|lastyear|lastmonth))?$/ ); if (!m) return null; - return { field: m[1], order: m[2], modifier: m[3] || null }; + return { order: m[1], modifier: m[2] || null }; } function getPostEntries(parsed, options) { - const { field, order, modifier } = parsed; + const { order, modifier } = parsed; // Start with posts from search index let posts = (searchIndex || []).filter(function(e) { @@ -1389,11 +1389,7 @@ function fmtDatetime(dtStr) { } // Field filter - if (field === 'datetime') { - posts = posts.filter(function(e) { return !!e.datetime; }); - } else { - posts = posts.filter(function(e) { return !!e.date; }); - } + posts = posts.filter(function(e) { return !!e.created; }); // Time-window filter if (modifier === 'lastyear' || modifier === 'lastmonth') { @@ -1402,15 +1398,13 @@ function fmtDatetime(dtStr) { if (modifier === 'lastyear') cutoff.setDate(cutoff.getDate() - 365); else cutoff.setDate(cutoff.getDate() - 30); posts = posts.filter(function(e) { - var raw = field === 'datetime' ? e.datetime.replace(' ', 'T') : e.date; - return new Date(raw) >= cutoff; + return new Date(e.created.replace(' ', 'T')) >= cutoff; }); } // Sort - var sortKey = field === 'datetime' ? 'datetime' : 'date'; posts.sort(function(a, b) { - var da = a[sortKey] || '', db = b[sortKey] || ''; + var da = a.created || '', db = b.created || ''; return order === 'chronological' ? da.localeCompare(db) : db.localeCompare(da); }); @@ -1523,7 +1517,6 @@ function fmtDatetime(dtStr) { var opts = tag.options; var posts = getPostEntries(parsed, opts); - var field = parsed.field; var modifier = parsed.modifier; var paginate = opts.paginate || 'no'; var limitVal = opts.limit || 'all'; @@ -1532,7 +1525,7 @@ function fmtDatetime(dtStr) { // Format each entry var formatted = posts.map(function(p) { return { - display: field === 'datetime' ? fmtDatetime(p.datetime) : fmtDate(p.date), + display: fmtDatetime(p.created), title: p.title, file: p.file }; @@ -1565,12 +1558,10 @@ function fmtDatetime(dtStr) { // Grouped by year (or year+month) function getYear(p) { - var d = field === 'datetime' ? p.datetime : p.date; - return d ? d.substring(0, 4) : 'Unknown'; + return p.created ? p.created.substring(0, 4) : 'Unknown'; } function getYearMonth(p) { - var d = field === 'datetime' ? p.datetime : p.date; - return d ? d.substring(0, 7) : 'Unknown'; + return p.created ? p.created.substring(0, 7) : 'Unknown'; } function monthLabel(ym) { var m = parseInt(ym.substring(5, 7), 10); @@ -2189,12 +2180,12 @@ function fmtDatetime(dtStr) { hydrateMdcmsTags(); const firstH = contentEl.querySelector('.md-content h1, .md-content h2'); - if (firstH && (meta.author || meta.created || meta.date || meta.datetime)) { + if (firstH && (meta.author || meta.created)) { const metaEl = document.createElement('div'); metaEl.className = 'page-meta'; let metaText = ''; if (meta.author) metaText += meta.author; - const displayDate = meta.datetime || meta.date || meta.created; + const displayDate = meta.created; if (displayDate) { if (metaText) metaText += ' | '; metaText += 'Published ' + formatDate(displayDate); diff --git a/app/pages/home.md b/app/pages/home.md index 5b41f1f..ccf41dc 100644 --- a/app/pages/home.md +++ b/app/pages/home.md @@ -18,7 +18,7 @@ If you want to test `MD-CMS` you can grab `samplesite` from the repo and place t ## Reverse chronological (newest first) ```mdcms -posts-date-reversechronological +posts-created-reversechronological limit: 3 paginate: no ``` @@ -26,25 +26,25 @@ paginate: no ## Chronological (oldest first) ```mdcms -posts-date-chronological +posts-created-chronological limit: all paginate: none ``` -## By year (date, reverse chrono) +## By year (reverse chrono) ```mdcms -posts-date-reversechronological-byyear +posts-created-reversechronological-byyear limit: all defaultyear: current selectyear: yes paginate: none ``` -## By year+month (datetime, chrono) +## By year+month (chrono) ```mdcms -posts-datetime-chronological-byyearmonth +posts-created-chronological-byyearmonth limit: all defaultyear: 2024 selectyear: yes @@ -53,7 +53,7 @@ selectyear: yes ## Last 30 days ```mdcms -posts-date-reversechronological-lastmonth +posts-created-reversechronological-lastmonth limit: all paginate: none ``` @@ -61,7 +61,7 @@ paginate: none ## Paginated (2 per page) ```mdcms -posts-datetime-reversechronological +posts-created-reversechronological limit: 2 paginate: yes ``` diff --git a/samplesite/pages/blog.md b/samplesite/pages/blog.md index e43716e..dc1b4ad 100644 --- a/samplesite/pages/blog.md +++ b/samplesite/pages/blog.md @@ -11,7 +11,7 @@ Stay up to date with announcements, product updates, and industry insights from ## All Posts ```mdcms -posts-date-reversechronological-byyear +posts-created-reversechronological-byyear limit: all defaultyear: current selectyear: yes diff --git a/samplesite/pages/blog.nb.md b/samplesite/pages/blog.nb.md index 23c1f01..5962716 100644 --- a/samplesite/pages/blog.nb.md +++ b/samplesite/pages/blog.nb.md @@ -11,7 +11,7 @@ Bli oppdatert med kunngjøringer, produktoppdateringer og bransjeinnsikter fra A ## Alle innlegg ```mdcms -posts-date-reversechronological-byyear +posts-created-reversechronological-byyear limit: all defaultyear: current selectyear: yes diff --git a/samplesite/posts/2022-q4-report.md b/samplesite/posts/2022-q4-report.md index c24a474..37cf475 100644 --- a/samplesite/posts/2022-q4-report.md +++ b/samplesite/posts/2022-q4-report.md @@ -1,7 +1,6 @@ --- title: Q4 2022 Performance Report -date: 2022-11-15 -datetime: 2022-11-15 09:00 +created: 2022-11-15 09:00 author: Sarah Chen --- diff --git a/samplesite/posts/2023-analytics-launch.md b/samplesite/posts/2023-analytics-launch.md index 96dd7d6..264e94a 100644 --- a/samplesite/posts/2023-analytics-launch.md +++ b/samplesite/posts/2023-analytics-launch.md @@ -1,7 +1,6 @@ --- title: Introducing Advanced Analytics Dashboard -date: 2023-03-22 -datetime: 2023-03-22 14:30 +created: 2023-03-22 14:30 author: David Okonkwo --- diff --git a/samplesite/posts/2023-security-update.md b/samplesite/posts/2023-security-update.md index 32e5169..e6046f4 100644 --- a/samplesite/posts/2023-security-update.md +++ b/samplesite/posts/2023-security-update.md @@ -1,7 +1,6 @@ --- title: Security Update - November 2023 -date: 2023-11-10 -datetime: 2023-11-10 11:45 +created: 2023-11-10 11:45 author: Security Team --- diff --git a/samplesite/posts/2024-roadmap.md b/samplesite/posts/2024-roadmap.md index b082033..1f0997e 100644 --- a/samplesite/posts/2024-roadmap.md +++ b/samplesite/posts/2024-roadmap.md @@ -1,7 +1,6 @@ --- title: 2024 Product Roadmap -date: 2024-01-30 -datetime: 2024-01-30 10:00 +created: 2024-01-30 10:00 author: David Okonkwo --- diff --git a/samplesite/posts/2024-success-stories.md b/samplesite/posts/2024-success-stories.md index 69be3fb..16a46bd 100644 --- a/samplesite/posts/2024-success-stories.md +++ b/samplesite/posts/2024-success-stories.md @@ -1,7 +1,6 @@ --- title: Q2 2024 Customer Success Stories -date: 2024-07-08 -datetime: 2024-07-08 15:20 +created: 2024-07-08 15:20 author: Maria Garcia --- diff --git a/samplesite/posts/2026-v9-release.md b/samplesite/posts/2026-v9-release.md index 63dfec1..20f37d5 100644 --- a/samplesite/posts/2026-v9-release.md +++ b/samplesite/posts/2026-v9-release.md @@ -1,7 +1,6 @@ --- title: Version 9.0 Released — A New Era -date: 2026-04-10 -datetime: 2026-04-10 13:00 +created: 2026-04-10 13:00 author: Sarah Chen ---