From 02144a9afea47e1db75e9f66f20d40da7486319a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=20Randall=20Havens=20=E2=96=B3=20The=20Empathic=20Tec?= =?UTF-8?q?hnologist=20=E2=9F=81=20Doctor=20Who=2042?= Date: Sat, 8 Nov 2025 19:08:52 -0600 Subject: [PATCH] Update generate-index.mjs --- tools/generate-index.mjs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/generate-index.mjs b/tools/generate-index.mjs index d468028..25d4015 100755 --- a/tools/generate-index.mjs +++ b/tools/generate-index.mjs @@ -75,6 +75,8 @@ async function collectFiles(relBase = "", flat = []) { title = parseTitle(raw, ext) || e.name.replace(new RegExp(`\\${ext}$`), "").trim(); } + // Use birthtimeMs (creation time), fallback to mtimeMs + const ctime = st.birthtimeMs || st.mtimeMs; const mtime = dateFromName(e.name) ?? st.mtimeMs; const baseName = e.name.slice(0, e.name.lastIndexOf('.')).toLowerCase(); @@ -84,7 +86,8 @@ async function collectFiles(relBase = "", flat = []) { title, path: rel, ext, - mtime, + ctime, // Creation timestamp + mtime, // For sorting excerpt: extractExcerpt(raw, ext), tags: extractTags(raw, ext, pdfData), isIndex: baseName === "index", @@ -97,7 +100,7 @@ async function collectFiles(relBase = "", flat = []) { (async () => { try { const flat = await collectFiles(); - // Sections = dirs with non-index files + // Only include sections with non-index files in dropdown const sections = [...new Set(flat.filter(f => !f.isIndex).map(f => f.path.split("/")[0]))].sort(); const allTags = [...new Set(flat.flatMap(f => f.tags))].sort(); await fs.writeFile(OUT, JSON.stringify({ flat, sections, tags: allTags }, null, 2));