Skip to content

feat(blog): add MDX-powered post system with content collections#2

Open
edwintantawi wants to merge 4 commits into
mainfrom
chore/markdown
Open

feat(blog): add MDX-powered post system with content collections#2
edwintantawi wants to merge 4 commits into
mainfrom
chore/markdown

Conversation

@edwintantawi

@edwintantawi edwintantawi commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

  • Add a content-collections + MDX pipeline for blog posts, streamed via RSC so compiled MDX never ships to the client bundle
  • New /posts and /posts/$slug routes backed by server functions in modules/post
  • Generalize i18n pathname/prerender helpers to accept a dynamic route list, so /posts prerenders per locale alongside /
  • Preload Geist fonts from a dedicated stylesheet to avoid render-blocking loads
  • Enable CSRF protection for server function requests

Test plan

  • vp check (format, lint, type check)
  • vp test
  • vp dev — verify /, /posts, and /posts/markdown-style-guide render correctly in both locales
  • Confirm compiled MDX is not present in the client bundle output

Split font imports out of app.css into their own stylesheet and preload
them from the root route, avoiding render-blocking font loads.
Add createCsrfMiddleware to the start instance so server function
requests are validated, independent of any specific route.
Introduce a content-collections pipeline that parses MDX posts under
src/content/posts, compiles them via @mdx-js/rollup, and streams the
rendered output through React Server Components so the compiled MDX
never ships to the client bundle.

- content-collections.ts defines the `posts` collection, validated
  against post.schema.ts and enriched with git-derived last-modified
  timestamps (modules/markdown/utils.ts).
- modules/post exposes server functions to list and load posts, used
  by the new /posts and /posts/$slug routes.
- vite.config.ts wires up the MDX plugin, content-collections vite
  plugin, and RSC support (needed to stream MDX without eval on
  Workers), and enables typography via @tailwindcss/typography.
- Generalize the i18n pathname/prerender helpers
  (lib/i18n/utils.ts) to accept an arbitrary route list instead of a
  fixed config object, so the new /posts routes can be prerendered
  per locale alongside /.
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

🚀 Preview Deployment (2)

Your changes have been deployed to a preview environment:

Name Preview URL Commit Updated (UTC)
devsantara-website-preview-2 Visit Preview 2abd470 Thu, 09 Jul 2026 09:44:42 GMT

🏗️ This comment updates automatically with each push.

…osts

Introduce a series content type on top of the existing MDX pipeline:

- Add `series` and `seriesPost` content collections with frontmatter
  validation, numeric order prefixes, and integrity checks that reject
  duplicate orders and posts orphaned by a missing `_index.mdx`.
- Add the series module (server functions, schema, types) exposing list,
  detail, and post loaders backed by RSC-streamed MDX.
- Add /series, /series/$slug, and /series/$slug/$postSlug routes plus a
  home-page nav link and the /series prerender path.
- Move markdown-style-guide.mdx into a markdown series and add sample
  frontend-development series content.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant