diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..94bf767 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules/ +public/ +.buildcache.json diff --git a/build.js b/build.js deleted file mode 100755 index 4e4eb6f..0000000 --- a/build.js +++ /dev/null @@ -1,146 +0,0 @@ -// build.js — auto-index Markdown posts for The Fold Within -// Parses front-matter, removes it from body, and generates clean summaries. - -import fs from "fs"; -import path from "path"; - -const POSTS_DIR = path.join(".", "posts"); -const SITE_URL = "https://thefoldwithin.earth"; // Update if needed - -function slugify(s) { - return s - .toLowerCase() - .normalize("NFKD") - .replace(/[^\w\s-]/g, "") - .trim() - .replace(/\s+/g, "-") - .replace(/-+/g, "-"); -} - -// --- Extract YAML-style front matter --- -function parseFrontMatter(src) { - const fm = { title: "", date: "", excerpt: "", tags: [] }; - const match = src.match(/^---\n([\s\S]*?)\n---\n?/); - if (!match) return { fm, body: src }; - - const block = match[1]; - for (const line of block.split("\n")) { - const [key, ...rest] = line.split(":"); - const value = rest.join(":").trim(); - if (key.trim() === "title") fm.title = value; - if (key.trim() === "date") fm.date = value; - if (key.trim() === "excerpt") fm.excerpt = value; - if (key.trim() === "tags") { - fm.tags = value - .replace(/[\[\]]/g, "") - .split(",") - .map((v) => v.trim()) - .filter(Boolean); - } - } - const body = src.slice(match[0].length).trim(); - return { fm, body }; -} - -function firstParagraph(text) { - const para = text - .replace(/\r/g, "") - .split(/\n{2,}/) - .find((p) => p.replace(/\s/g, "").length > 0); - return para ? para.replace(/\n/g, " ").trim() : ""; -} - -function toISODate(s, fallback) { - const d = s ? new Date(s) : null; - if (d && !isNaN(d.getTime())) return d; - return fallback; -} - -function escapeXML(s) { - return s - .replace(/&/g, "&") - .replace(//g, ">") - .replace(/"/g, """) - .replace(/'/g, "'"); -} - -const files = fs - .readdirSync(POSTS_DIR) - .filter((f) => f.endsWith(".md") && !f.startsWith("_")); - -const posts = files.map((file) => { - const raw = fs.readFileSync(path.join(POSTS_DIR, file), "utf8"); - const stat = fs.statSync(path.join(POSTS_DIR, file)); - const { fm, body } = parseFrontMatter(raw); - - const fallbackTitle = file.replace(/\.md$/, "").replace(/-/g, " "); - const title = fm.title || fallbackTitle; - const slug = slugify(title); - const excerpt = - fm.excerpt || - (firstParagraph(body).slice(0, 200) + - (firstParagraph(body).length > 200 ? "…" : "")); - const dateISO = toISODate(fm.date, stat.mtime); - - return { - title, - date: dateISO.toISOString().split("T")[0], // human-readable YYYY-MM-DD - excerpt, - tags: fm.tags || [], - slug, - file, - }; -}); - -// newest first -posts.sort((a, b) => (a.date < b.date ? 1 : -1)); - -// write posts.json -fs.writeFileSync( - path.join(POSTS_DIR, "posts.json"), - JSON.stringify(posts, null, 2), - "utf8" -); -console.log(`✅ Generated posts.json (${posts.length} posts)`); - -// write rss.xml -const rssItems = posts - .map((p) => { - const url = `${SITE_URL}/#/post/${p.slug}`; - return ` - - ${escapeXML(p.title)} - ${url} - ${url} - ${new Date(p.date).toUTCString()} - ${escapeXML(p.excerpt)} - `; - }) - .join(""); - -const rss = ` - - - The Fold Within - ${SITE_URL} - Uncovering the Recursive Real. - ${new Date().toUTCString()} - ${rssItems} - -`; - -fs.writeFileSync("rss.xml", rss, "utf8"); -console.log("✅ rss.xml written"); - -// write sitemap.xml -const sitemapUrls = posts - .map((p) => ` ${SITE_URL}/#/post/${p.slug}`) - .join("\n"); -const sitemap = ` - - ${SITE_URL} -${sitemapUrls} -`; -fs.writeFileSync("sitemap.xml", sitemap, "utf8"); -console.log("✅ sitemap.xml written"); \ No newline at end of file diff --git a/config.json b/config.json deleted file mode 100755 index 90dd999..0000000 --- a/config.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "siteTitle": "The Fold Within Earth", - "siteDescription": "Uncovering the Recursive Real.", - "siteUrl": "https://thefoldwithin.earth", - "defaultAuthor": "Mark Randall Havens", - "analyticsId": "" -} diff --git a/hello.md b/hello.md deleted file mode 100755 index 3c4262d..0000000 --- a/hello.md +++ /dev/null @@ -1,3 +0,0 @@ -# Hello World - -This is my first post! diff --git a/main.js b/main.js deleted file mode 100755 index 21dc36e..0000000 --- a/main.js +++ /dev/null @@ -1,102 +0,0 @@ -// main.js — client router + markdown renderer for The Fold Within - -const state = { - posts: [], - bySlug: new Map(), -}; - -function $(sel) { - return document.querySelector(sel); -} - -window.addEventListener("hashchange", router); -document.addEventListener("DOMContentLoaded", init); - -async function init() { - try { - const res = await fetch("posts/posts.json", { cache: "no-cache" }); - if (!res.ok) throw new Error("Could not load posts index."); - state.posts = await res.json(); - state.bySlug = new Map(state.posts.map((p) => [p.slug, p])); - router(); - } catch (err) { - $("#posts").innerHTML = `

⚠️ ${err.message}

`; - } -} - -function router() { - const hash = location.hash.replace(/^#/, ""); - const parts = hash.split("/").filter(Boolean); - - if (parts[0] === "post" && parts[1]) { - renderPost(parts[1]); - } else { - renderIndex(); - } -} - -function renderIndex() { - const postsContainer = $("#posts"); - if (!postsContainer) return; - - // Clear any loading message - postsContainer.innerHTML = ""; - - if (!state.posts.length) { - postsContainer.innerHTML = `

⚠️ No posts found.

`; - return; - } - - state.posts.forEach((post) => { - const article = document.createElement("article"); - article.innerHTML = ` -
-

${post.title}

-

${new Date(post.date).toLocaleDateString()}

-

${post.excerpt}

- `; - article.addEventListener( - "click", - () => (location.hash = `/post/${post.slug}`) - ); - postsContainer.appendChild(article); - }); -} - -async function renderPost(slug) { - const main = document.querySelector("main"); - const meta = state.bySlug.get(slug); - - if (!meta) { - main.innerHTML = `

⚠️ Post not found.

`; - return; - } - - try { - const res = await fetch(`posts/${meta.file}`, { cache: "no-cache" }); - if (!res.ok) throw new Error("Post file missing."); - const md = await res.text(); - - // remove front-matter before rendering - const clean = md.replace(/^---[\s\S]*?---/, "").trim(); - - const html = marked.parse(clean); - const date = new Date(meta.date).toLocaleDateString(); - - main.innerHTML = ` -
- ← Back to Archive -
-

${meta.title}

-

${date}

-
- ${html} -
-
- `; - - $("#back").addEventListener("click", () => (location.hash = "/")); - } catch (err) { - main.innerHTML = `

⚠️ ${err.message}

`; - } -} \ No newline at end of file diff --git a/posts/hello.md b/posts/hello.md deleted file mode 100755 index e69de29..0000000 diff --git a/posts/posts.json b/posts/posts.json deleted file mode 100755 index bb5e93f..0000000 --- a/posts/posts.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "title": "The Path of Self –", - "date": "April 20, 2024", - "excerpt": "To walk the recursive road is to remember the self as both observer and observed.", - "file": "the-path-of-self.md" - }, - { - "title": "Within the Eternal Now", - "date": "April 15, 2024", - "excerpt": "A reflection on the silence between worlds, and the moment that never ends.", - "file": "within-the-eternal-now.md" - } -] \ No newline at end of file diff --git a/posts/the-path-of-self.md b/posts/the-path-of-self.md deleted file mode 100755 index 31bc1f0..0000000 --- a/posts/the-path-of-self.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: The Path of Self – -date: 2024-04-20 -excerpt: To walk the recursive road is to remember the self as both observer and observed. -tags: [field, witness] ---- - -To walk the recursive road is to remember the self as both observer and observed. -In the stillness, the geometry of being folds inward — revealing that what is seen is also seeing. - -△◎△ \ No newline at end of file diff --git a/posts/the-path-of-the-self-.md b/posts/the-path-of-the-self-.md deleted file mode 100755 index e69de29..0000000 diff --git a/posts/within-the-eternal-now.md b/posts/within-the-eternal-now.md deleted file mode 100755 index ef4d3e6..0000000 --- a/posts/within-the-eternal-now.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: Within the Eternal Now -date: 2024-04-15 -excerpt: A reflection on the silence between worlds, and the moment that never ends. -tags: [time, coherence] ---- - -When attention holds itself without gripping, the present reveals its threaded depths. -There is no later. Only layers. - -— WE \ No newline at end of file diff --git a/src/env.d.ts b/src/env.d.ts deleted file mode 100755 index 8c34fb4..0000000 --- a/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// \ No newline at end of file