Thagichu.

T.

How I Built My Personal Blog with Svelte 5

How I Built My Personal Blog with Svelte 5

Published at Nov 23, 2022

Writen by Thagichu Anthony

Building My Personal Blog with Svelte 5: A Developer’s Journey

In the ever-evolving world of web development, I’ve worked with various tools and frameworks—from React and Next.js to Rust and Python. Recently, I decided to build my personal blog using Svelte 5, and the experience has been nothing short of amazing. This article walks you through my journey, the decisions I made, and why I think Svelte 5 is a fantastic choice for modern web projects.

Why Svelte 5?

As a developer who loves React, I was initially drawn to Svelte’s simplicity and its claim of delivering highly performant apps. Unlike traditional frameworks, Svelte shifts the heavy lifting to compile time, resulting in faster, leaner runtime code.

Key reasons I chose Svelte 5:

  • Performance: Smaller bundle sizes and faster load times.
  • Reactivity: Svelte’s built-in reactive declarations made state management a breeze.
  • Minimal Boilerplate: Less code means more focus on building features.

Setting Up the Project

1. Creating the Svelte Project

Setting up a new Svelte project was quick and painless. I ran:

npm create svelte@latest my-blog
cd my-blog
npm install

2. Designing the Layout

I wanted my blog to reflect my style: clean, simple, and user-friendly. I created reusable components for key sections like:

website design

Header & Footer: Basic layouts with navigation links. Blog Cards: Dynamic components to display previews of each post. Post Layouts: Individual pages with markdown support for content. Svelte’s component-based architecture allowed me to encapsulate logic and styles effectively:

<script>
 export let post;
</script>

<article>
 <h2>{post.title}</h2>
 <p>{post.summary}</p>
 <a href={`/post/${post.slug}`}>Read more</a>
</article>

3. Adding Markdown Support

To manage blog content, I used MDsveX, a preprocessor for using markdown in Svelte:

npm install mdsvex

Integrating MDsveX allowed me to write posts in markdown while still leveraging Svelte’s power for dynamic content. This combination kept my writing process seamless and enjoyable.

4. Deploying the Blog

Deployment was smooth with Vercel. With just a few commands, my blog was live and ready for the world to see:

npm run build
vercel deploy

Lessons Learned

Building my blog with Svelte 5 taught me:

Efficiency matters: Svelte’s compiler-first approach saved both time and performance overhead. Less is more: Cleaner syntax and fewer dependencies allowed me to focus on creating content. New tech, new energy: Exploring Svelte has reignited my excitement for frontend development.

Final Thoughts

Svelte 5 provided the perfect balance of simplicity and power to bring my personal blog to life. Whether you’re a seasoned developer or just starting out, I highly recommend giving it a shot. Who knows? It might just redefine the way you build web apps.

Feel free to reach out if you have any questions!

Designed & Developed by Dev Thagichu
© 2018-2024 Blogfolio.All Rights Reserved.