Introduction

Pass theme option to sveltepress to use a theme

Read Vite plugin options and Default theme options for more details

ChooseBest forContent modelSearch
Default themeDocumentation, product guides, API referencesSvelteKit routes written as Markdown or SvelteAlgolia DocSearch or Meilisearch through a custom wrapper (see the production caveat)
Blog themeEditorial sites and chronological publicationsMarkdown files in src/posts plus generated routesBuilt-in Pagefind integration

Default theme

Install

npm install --save @sveltepress/theme-default
sh
yarn add @sveltepress/theme-default
sh
pnpm install @sveltepress/theme-default
sh
bun add @sveltepress/theme-default
sh

Add in your vite config

vite.config.(js|ts)
+
+
import { const defaultTheme: ThemeDefaultdefaultTheme } from '@sveltepress/theme-default' 
import { const sveltepress: (options?: SveltepressVitePluginOptions) => PluginOptionsveltepress } from '@sveltepress/vite'

import { function defineConfig(config: UserConfig): UserConfig (+5 overloads)

Type helper to make it easier to use vite.config.ts accepts a direct

UserConfig

object, or a function that returns it. The function receives a

ConfigEnv

object.

defineConfig
} from 'vite'
const const config: UserConfigconfig = function defineConfig(config: UserConfig): UserConfig (+5 overloads)

Type helper to make it easier to use vite.config.ts accepts a direct

UserConfig

object, or a function that returns it. The function receives a

ConfigEnv

object.

defineConfig
({
UserConfig.plugins?: PluginOption[] | undefined

Array of vite plugins to use.

plugins
: [
function sveltepress(options?: SveltepressVitePluginOptions): PluginOptionsveltepress({ SveltepressVitePluginOptions.theme?: ResolvedTheme | undefinedtheme: function defaultTheme(themeOptions?: DefaultThemeOptions | undefined): ResolvedThemedefaultTheme(/** theme options */) }) ], }) export default const config: UserConfigconfig
ts

Get more info about default theme in Default theme reference

Blog theme

The blog theme adds post indexing, pagination, tags, categories, RSS, Open Graph images, related posts, comments, and a Pagefind search UI. It generates a static site and currently requires @sveltejs/adapter-static plus a Pagefind post-build step.

Start with the blog theme guide and use the live demo as the runnable reference.