Skip to content
Starlight Blog
GitHub
Blog

Getting Started

Install the Starlight Blog integration using your favorite package manager:

pnpm add starlight-blog

Update your Astro configuration to include the Starlight Blog integration before the Starlight integration:

import starlight from '@astrojs/starlight'
import { defineConfig } from 'astro/config'
import starlightBlog from 'starlight-blog'

export default defineConfig({
  // …
  integrations: [
    // Add the Starlight Blog integration.
    starlightBlog(),
    starlight({
      sidebar: [
        {
          label: 'Guides',
          items: [{ label: 'Example Guide', link: '/guides/example/' }],
        },
      ],
      title: 'My Docs',
    }),
  ],
})

Update the Starlight Content Collections configuration in src/content/config.ts to use a new schema supporting blog posts:

import { docsSchema, i18nSchema } from '@astrojs/starlight/schema'
import { defineCollection } from 'astro:content'
import { docsAndBlogSchema } from 'starlight-blog/schema'

export const collections = {
  // Use the Starlight Blog integration schema.
  docs: defineCollection({ schema: docsAndBlogSchema }),
  i18n: defineCollection({ type: 'data', schema: i18nSchema() }),
}

Create your first blog post by creating a .md or .mdx file in the src/content/docs/blog/ directory:

---
title: My first blog post
date: 2023-07-24
---

## Hello

Hello world!

Configuration

You can pass the following options to the Starlight Blog integration:

NameDescriptionDefault
authorsA list of global authors. Check the authors page for more informations.{}
postCountThe number of blog posts to display per page in the blog post list.5
recentPostCountThe number of recent blog posts to display in the sidebar.10
titleThe title of the blog.‘Blog’

Frontmatter

Individual blog posts can be customized using their frontmatter. A blog post must at least have a title and a date (posts are sorted by descending date) property:

---
title: Documentation 101
date: 2023-07-24
---

Let's learn how to write documentation!
NameDescriptionRequired
authorsThe author(s) of the blog post. Check the authors page for more informations.
dateThe date of the blog post which must be a valid YAML timestamp.
excerptThe excerpt of the blog post used in the blog post list and tags pages. If not provided, the entire blog post content will be rendered.
tagsA list of tags associated with the blog post.