Sveltekit Blog Starter screenshot

Sveltekit Blog Starter

Updated: 21 Jan 2025
469 Stars

A preconfigured SvelteKit static blog starter, with Sass, Markdown, MDSvex, Rehype, background preloading, and more. See the README for full details.

Categories

Overview

The SvelteKit static blog starter is a comprehensive solution for creating a static site generator for Markdown and Svelte-powered blogs. It leverages the power of SvelteKit to provide fast static site generation with hydration, allowing every route to be compiled into static HTML and optionally routed with JavaScript. With features such as zero-config preloading, Markdown support, pagination, category pages, and a JSON API for posts, this starter provides everything needed to create a dynamic and efficient blog. It also includes several customization options and features for enhanced SEO, responsive design, and page transitions.

Features

  • Fully up-to-date with SvelteKit 1.0
  • Super fast static site generation with hydration
  • Zero-config preloading for automatic background preloading of top-level pages
  • Markdown support with a pre-configured blog
  • Pagination included with customizable posts per page
  • Category pages included
  • Posts JSON API
  • Sass pre-installed and configured
  • mdsvex pre-installed - allows the use of Svelte components inside Markdown
  • Rehype plugins included - generate unique heading IDs for direct linking
  • Responsive and accessible defaults - includes “skip to content” link and accessible mobile nav menu
  • Page transitions
  • Basic SEO for blog posts
  • RSS feed set up and ready to go

Installation

To get started with the SvelteKit static blog starter, follow these steps:

  1. Clone or download the repository.
  2. Install the dependencies by running the following command:
npm install
  1. Run the development server with the following command:
npm run dev

This will start the dev server, and any changes made to components and styles will auto-refresh quickly.

Next, update the src/lib/config.js file to reflect your site’s domain and preferences. This file is also where the navigation menu can be updated.

To add new posts, simply drop a new Markdown (.md) file into the src/lib/posts directory. The new posts will automatically be displayed on the site, added to the posts API, and included in any category pages. It is important to define the date and an excerpt in the frontmatter of each post, as they are used for sorting and SEO meta tags.

If customization is needed for the layout or other frontmatter properties, make changes in the src/routes/blog/[post]/+page.svelte file.

Summary

The SvelteKit static blog starter is an all-inclusive solution for creating a static site generator for Markdown and Svelte-powered blogs. It provides efficient static site generation with hydration, a pre-configured blog setup with Markdown support, pagination, category pages, and a JSON API for posts. The starter also offers customization options, responsive design, page transitions, and basic SEO features. With easy installation steps and straightforward customization instructions, this starter is a great choice for getting started with SvelteKit and building a powerful blog.