April 19, 2025
Each blog post has a slug (used in the URL), a title, a short description, and an array of sections. Each section can include a heading, paragraph, image, and a link for extra resources. This way, I can break up a blog post into readable chunks and add media or references where needed.
Here is the code snippet to the Blog type I definedRather than write my blog content in raw JSX or Markdown, I chose to structure it in JSON for simplicity and reusability. With this structure, I can import or fetch this JSON into my frontend, validate it against the Blog type, and render it dynamically.
Here is the code snippet to the example Json DataIt is super flexible—if a section does not have a link or image, it just skips that part. And I get full type safety thanks to TypeScript.
Here's the code snippet on how I rendered these sectionsThis setup is great for personal projects or blogs that do not need complex CMS features. It is fast, lightweight, and developer-friendly. Plus, having everything typed makes the code way more maintainable in the long run. If you're looking to build a blog without the overhead of a CMS, this might just be your jam.