From 02a7a6197fa90649d203ae39b31b3a3f95b0a639 Mon Sep 17 00:00:00 2001 From: andwati Date: Sun, 30 Aug 2026 19:04:25 +0300 Subject: [PATCH] Add feeds, sitemap, search, tags, and per-post nav/TOC/series/related MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - src/site.config.ts: minimal site metadata (title, description, base URL, nav, tag descriptions) ported from the legacy zola.toml as a placeholder pending real design/copy. - RSS (@astrojs/rss) and JSON Feed endpoints, sitemap (@astrojs/sitemap), robots.txt. - Base.astro: meta description (site-wide default or per-page override via llms_description/description), RSS/JSON feed , and a webmention endpoint link (plumbing only — needs the domain registered on webmention.io to do anything). - toml-content-loader.ts: marked renderer now assigns heading ids and collects them into rendered.metadata.headings, so render(entry) exposes headings the same way a built-in Markdown loader would. - Writing detail page: table of contents, prev/next navigation, series-nav (uses the existing extra.series/series_index fields), and tag-overlap related posts. - Tags index + per-tag pages, tag links wired in from writing cards. - Pagefind: indexes the build output as part of `pnpm build` (astro build && pagefind --site dist), plus a /search/ page using Pagefind's default UI. Verified: astro check clean, full build succeeds (feeds/sitemap/ pagefind all generate correctly), and manually exercised /search/ (real query, highlighted results) and /tags/ in a browser against the built site. --- apps/site/astro.config.mjs | 7 +- apps/site/package.json | 10 +- apps/site/src/layouts/Base.astro | 12 +- apps/site/src/lib/toml-content-loader.ts | 37 +- apps/site/src/pages/feed.json.ts | 31 + apps/site/src/pages/rss.xml.ts | 23 + apps/site/src/pages/search.astro | 22 + apps/site/src/pages/tags/[tag].astro | 35 + apps/site/src/pages/tags/index.astro | 26 + apps/site/src/pages/writings/[...slug].astro | 96 ++- apps/site/src/pages/writings/index.astro | 2 +- apps/site/src/site.config.ts | 28 + pnpm-lock.yaml | 825 +++++++++++++++++++ 13 files changed, 1145 insertions(+), 9 deletions(-) create mode 100644 apps/site/src/pages/feed.json.ts create mode 100644 apps/site/src/pages/rss.xml.ts create mode 100644 apps/site/src/pages/search.astro create mode 100644 apps/site/src/pages/tags/[tag].astro create mode 100644 apps/site/src/pages/tags/index.astro create mode 100644 apps/site/src/site.config.ts diff --git a/apps/site/astro.config.mjs b/apps/site/astro.config.mjs index 17f6a62..ec54e64 100644 --- a/apps/site/astro.config.mjs +++ b/apps/site/astro.config.mjs @@ -1,5 +1,10 @@ // @ts-check +import sitemap from "@astrojs/sitemap"; import { defineConfig } from "astro/config"; +import { siteConfig } from "./src/site.config.ts"; // https://astro.build/config -export default defineConfig({}); +export default defineConfig({ + site: siteConfig.baseUrl, + integrations: [sitemap()], +}); diff --git a/apps/site/package.json b/apps/site/package.json index 7b768d8..52cc096 100644 --- a/apps/site/package.json +++ b/apps/site/package.json @@ -7,16 +7,24 @@ }, "scripts": { "dev": "astro dev", - "build": "astro build", + "build": "astro build && pagefind --site dist", "preview": "astro preview", + "check": "astro check", "astro": "astro" }, "dependencies": { + "@astrojs/rss": "^4.0.19", + "@astrojs/sitemap": "^3.7.3", "astro": "^7.2.9", "marked": "^18.0.11", + "pagefind": "^1.5.2", "smol-toml": "^1.8.0" }, "allowScripts": { "esbuild": true + }, + "devDependencies": { + "@astrojs/check": "^0.9.10", + "typescript": "^5.9.3" } } diff --git a/apps/site/src/layouts/Base.astro b/apps/site/src/layouts/Base.astro index 43883d5..86fba5e 100644 --- a/apps/site/src/layouts/Base.astro +++ b/apps/site/src/layouts/Base.astro @@ -1,8 +1,12 @@ --- +import { siteConfig } from "../site.config"; + interface Props { title: string; + description?: string; } -const { title } = Astro.props; +const { title, description } = Astro.props; +const metaDescription = description ?? siteConfig.description; --- @@ -10,6 +14,10 @@ const { title } = Astro.props; {title} — andwati.com + + + +