Analog

Documentation

Quickstart

Installation

npm create --yes analog@latest# For the `What would you like to start?` prompt, select `blog`cd analog-projectnpm install

Configuration

Configure the Static Site Generation options:

Prerendering SSG Content is the same for API Routes as it is for pages.

For the blog example, your configuration may look like:

vite.config.ts

/// <reference types="vitest" />import { defineConfig } from 'vite';import analog, { type PrerenderContentFile } from '@analogjs/platform'; // https://vitejs.dev/config/export default defineConfig(({ mode }) => ({  build: {    target: ['es2020'],  },  resolve: {    mainFields: ['module'],  },  plugins: [    analog({      content: {        highlighter: 'shiki',      },      static: true,      prerender: {        routes: async () => [          '/',          '/blog',          {            contentDir: 'src/content',            transform: (file: PrerenderContentFile) => {              // do not include files marked as draft in frontmatter              if (file.attributes['draft']) {                return false;              }              // use the slug from frontmatter if defined, otherwise use the file’s basename              const slug = file.attributes['slug'] || file.name;              return `/blog/${slug}`;            },          },        ],        sitemap: {          host: 'https://analog.bunny-launcher.net/',        },      },    }),  ],  test: {    globals: true,    environment: 'jsdom',    setupFiles: ['src/test-setup.ts'],    include: ['**/*.spec.ts'],    reporters: ['default'],  },  define: {    'import.meta.vitest': mode !== 'production',  },}));

Deployment

Build

npm run build

Preview

npx --yes serve@latest --single dist/client

Deploy

npx --yes bunny-launcher@latest --interactive