diff --git a/.gitignore b/.gitignore index 6f55e003..35541e74 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,10 @@ node_modules +.DS_Store *.log .saber public _site/ +.cache/ .yarn/install-state.gz # wrangler files @@ -10,4 +12,4 @@ _site/ .dev.vars* !.dev.vars.example .env* -!.env.example \ No newline at end of file +!.env.example diff --git a/README.md b/README.md index 7a816522..836062fa 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,12 @@ src/ │ ├── layouts/ │ │ ├── base.njk # Base HTML (head, OG tags, Twitter Cards) │ │ ├── post.njk # Blog post layout (tags, giscus comments) +│ │ ├── rambling.njk # Informal note layout │ │ └── page.njk # Static page layout │ ├── header.njk │ └── footer.njk ├── posts/ # Blog posts (markdown) +├── ramblings/ # Public, informal and evolving notes ├── pages/ # Static pages (about, friends, archives) ├── drafts/ # Draft posts (excluded from build) ├── assets/ # Images and files (passthrough copy) @@ -49,6 +51,9 @@ src/ ├── index.njk # Homepage with pagination ├── feed.njk # Atom feed ├── feed-json.njk # JSON feed +├── ramblings.njk # Ramblings index +├── ramblings-feed.njk # Ramblings Atom feed +├── ramblings-feed-json.njk # Ramblings JSON feed ├── sitemap.njk # Sitemap ├── tags.njk # Tag listing page ├── tag-page.njk # Individual tag page template @@ -56,6 +61,21 @@ src/ eleventy.config.js # Eleventy configuration ``` +## Ramblings + +Ramblings are public, lightly edited notes kept separate from polished blog posts. Add a Markdown file to `src/ramblings/` with at least a title and date: + +```yaml +--- +title: Notes from ASC 2026 +date: 2026-09-21 +updated: 2026-09-24 +description: Hotel selection, transportation, and miscellaneous conference notes. +--- +``` + +Store related media under `src/assets/media//` and reference it as `/assets/media//`. Use `comments: false` to disable comments for a note. If it later becomes a polished post, keep the original rambling in place and set `supersededBy: /posts//`. + ## Development ```bash diff --git a/eleventy.config.js b/eleventy.config.js index 36ccc51e..cde5502c 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -54,6 +54,11 @@ export default function (eleventyConfig) { eleventyConfig.addPassthroughCopy("src/assets/media"); eleventyConfig.addPassthroughCopy("src/static"); + // Keep informal notes separate from the regular post collection. + eleventyConfig.addCollection("ramblings", (collectionApi) => { + return collectionApi.getFilteredByGlob("src/ramblings/*.md"); + }); + // --- Tailwind CSS --- eleventyConfig.on("eleventy.before", async () => { const inputFile = path.resolve("src/css/main.css"); @@ -86,6 +91,16 @@ export default function (eleventyConfig) { eleventyConfig.addFilter("currentYear", () => new Date().getFullYear()); + eleventyConfig.addFilter("newestUpdatedDate", (items = []) => { + if (!items.length) return new Date(); + + return new Date( + Math.max( + ...items.map((item) => new Date(item.data.updated || item.date).getTime()) + ) + ); + }); + eleventyConfig.addFilter("dateToPath", (dateObj) => { const d = new Date(dateObj); const year = d.getUTCFullYear(); @@ -98,7 +113,7 @@ export default function (eleventyConfig) { eleventyConfig.addFilter("getTagList", (collections) => { const tags = new Set(); for (const name in collections) { - if (name === "posts" || name === "all") continue; + if (name === "posts" || name === "ramblings" || name === "all") continue; tags.add(name); } return [...tags].sort(); diff --git a/src/_data/site.json b/src/_data/site.json index 1bc1a230..aa7deefb 100644 --- a/src/_data/site.json +++ b/src/_data/site.json @@ -7,9 +7,10 @@ "twitter": "_NeverBehave_", "icon": "/static/icons/android-chrome-512x512.png", "nav": [ - { "text": "Home", "link": "/" }, - { "text": "About", "link": "/about/" }, - { "text": "Social", "link": "https://never.pet" }, - { "text": "Friends", "link": "/friends/" } + { "text": "首页", "link": "/" }, + { "text": "关于", "link": "/about/" }, + { "text": "碎碎念", "link": "/ramblings/" }, + { "text": "社交", "link": "https://never.pet" }, + { "text": "友链", "link": "/friends/" } ] } diff --git a/src/_includes/footer.njk b/src/_includes/footer.njk index 1d2ac3dc..d3b7a019 100644 --- a/src/_includes/footer.njk +++ b/src/_includes/footer.njk @@ -2,7 +2,10 @@

© 2017–{{ "" | currentYear }} {{ site.author }} · {{ site.description }}

- RSS + RSS: + 文章 + · + 碎碎念

diff --git a/src/_includes/header.njk b/src/_includes/header.njk index 0406910d..000f730c 100644 --- a/src/_includes/header.njk +++ b/src/_includes/header.njk @@ -3,7 +3,7 @@ {{ site.title }} -