Files
evig/docs/BLOG_IMPROVEMENT_PLAN.md
Mao NakamotoandClaude Fable 5 9d9b470b62 feat(blog): full subsystem build-out — comments moderation, search/tags/pagination, share, admin fixes
Reader side:
- Search (?q=), tag (?tag=) and category (?categories=) filters on the index;
  search/tag render a flat paginated result list with count + clear pill
- Index + admin pagination (paginateBlogIndex + SQL LIMIT/OFFSET); admin stats
  now from SQL aggregates over ALL posts (were computed from the 50-row slice)
- Clickable category eyebrow + tag pills (SSOT slug via slugifyCategory)
- Prev/next post navigation; loading skeleton; 44px tap targets
- Copy-link + native share (SSR-safe via useSyncExternalStore)
- RSS discoverable (alternates.types + nav link); newsletter on the index

Admin / correctness:
- Comment moderation page /admin/content/blog/comments (hide/unhide + delete);
  staff-only PATCH /api/blog/comments/[id] writes the hidden status
- SEO fields now persist on create (were silently dropped)
- PATCH rejects blanking a live post's title/body
- Featured-image upload via /api/uploads (was URL-paste only)
- DB-error banner instead of silent file-only fallback

Design/i18n/tests:
- Admin editor + RelatedPosts use the <Card> primitive
- 15 new keys across all 8 locales; paginateBlogIndex unit-tested
- docs/BLOG_IMPROVEMENT_PLAN.md tracks remaining decisions

Also ships the tablets article kiosk-mode section (+ 7 translations).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 20:26:13 +02:00

4.6 KiB

Blog Improvement Plan

Living tracker for the blog subsystem (reader + admin). Born from the full audit on 2026-07-14. Check items off as they ship. Keep this file honest — it is the SSOT for "what's left" on the blog.

Architecture reminder: the public site renders a merge of content/posts/*.md (git) + blog_posts (DB), deduped by slug (DB wins) — src/lib/blog-merge.ts. Comments (blog_comments, migration 119) are keyed by slug, so they work for both sources. Admin manages the DB blog at /admin/content/blog.


Phase 1 — Correctness bugs (data-loss / abuse risk) ✅ DONE 2026-07-14

  • SEO fields dropped on create — POST /api/admin/blog now reads + inserts seoTitle/seoDescription (was only persisted on PATCH → save-edit-save dance). src/app/api/admin/blog/route.ts
  • PATCH could blank a live post — reject empty title/content when explicitly provided. src/app/api/admin/blog/[id]/route.ts
  • Silent DB-error fallback in admin list — DB failure now logs + shows a warning banner instead of masquerading as a file-only list. src/app/admin/content/blog/page.tsx
  • Comment moderation surface — new staff-only PATCH /api/blog/comments/[id] hide/unhide (uses the pre-existing hidden status), plus a dedicated moderation page /admin/content/blog/comments (list, search, filter, hide/ unhide, delete) linked from the blog admin header. src/app/admin/content/blog/comments/*, src/app/api/blog/comments/[id]/route.ts
  • Featured-image upload — sidebar now has an "Bild hochladen" button wired to the existing /api/uploads (R2), not URL-paste only. src/components/admin/blog/BlogPostSidebar.tsx

Phase 2 — Reader-facing quick wins ✅ DONE 2026-07-14

  • RSS discoverable — alternates.types RSS link in the index metadata + a visible RSS icon-link in the blog nav bar. i18n key blog.rss.
  • Copy-link / native share — copy-URL button with copied-feedback and a navigator.share button (mobile, mount-detected). ShareButtons.tsx.
  • Clickable taxonomy — the post's category eyebrow links to /blog?categories=<slug> (DB slug or slugifyCategory fallback — SSOT in blog-utils.ts); tag pills link to /blog?tag=<tag>.
  • Previous / next post navigation — BlogPrevNext.tsx (sequential over the public listing, date-desc).
  • Index loading skeleton — blog/loading.tsx.
  • Tap targets — mobile filter pills min-h-11, comment delete h-11 w-11 sm:h-8 sm:w-8, tag pills min-h-11.
  • Category pill row — desktop row scrolls horizontally (overflow-x-auto, hidden scrollbar) instead of overflowing the sticky bar.
  • Newsletter on the index — NewsletterSignup before the footer CTA.

Phase 3 — Scale features ✅ DONE 2026-07-14

  • Index pagination — paginateBlogIndex() in blog-utils.ts (unit-tested), BLOG_PAGE_SIZE in src/config/blog.ts, shared Pagination primitive; filters preserved in page links; out-of-range pages clamp.
  • Admin list pagination — SQL LIMIT/OFFSET + count aggregate; stats now computed via SQL over ALL posts (was: page slice); file posts pinned to page 1.
  • Blog search — ?q= server-side match over title/excerpt/tags, search field in the nav (desktop + mobile dropdown), result-count + clear-filter bar. Deliberate non-Meilisearch (YAGNI at current volume; revisit at ~100+ posts).
  • Tag filtering — ?tag= on the index (flat result list); tag pills on posts link there. Dedicated /blog/tag/<tag> pages deliberately NOT built — the query-param filter covers the need without new routes.

Phase 4 — Design-system consistency ✅ DONE 2026-07-14

  • Admin editor form uses <Card> — all 9 hand-rolled card divs in BlogPostSidebar/BlogPostEditor replaced with the primitive. The publish toggle stays hand-rolled (single instance — extraction is premature until the 3rd use).
  • RelatedPosts card — now uses the <Card> primitive.
  • X share button bg-black — kept: brand-standard for X, matches the other bg-brand-* social buttons.

Decisions (need a human call before building)

  • Guest comments? Today comments require login. If we ever allow guest comments, a pre-publish moderation queue becomes mandatory (spam). The hide/ unhide plumbing from Phase 1 is the foundation; a pending status + queue view would extend it.
  • Likes / reactions / bookmarks — intentionally absent. Build only if we decide engagement metrics are worth the surface area.

Audit + Phase 1 by Claude, 2026-07-14.