1.1 Starlight Overview
Starlight Astro is a documentation theme built on top of the Astro framework. It’s designed specifically for creating static sites for documentation purposes, like personal or project docs. Starlight comes with features such as:
- Pre-built navigation.
- Support for table of contents.
- Search integration.
- Customizable frontmatter.
- Easy internationalization support.
1. Getting Started with Starlight Astro
-
Install Astro
- First, make sure you have Node.js installed. Then, install Astro using the following command:
Terminal window npm create astro@latest
- First, make sure you have Node.js installed. Then, install Astro using the following command:
-
Install Starlight Theme
- After setting up the Astro project, install the Starlight theme by running:
Terminal window npm install @astrojs/starlight
- After setting up the Astro project, install the Starlight theme by running:
-
Configure the Starlight Theme
- Open the
astro.config.mjs
file and add the Starlight integration:import { defineConfig } from 'astro/config';import starlight from '@astrojs/starlight';export default defineConfig({integrations: [starlight()],});
- Open the
-
Create Documentation Pages
- In the
src/pages/
directory, create markdown (.mdx
or.md
) files to start writing your docs. The basic structure might look like this:src/└── pages/└── index.md
- In the
-
Run the Development Server
- Start the Astro development server to preview your documentation:
Terminal window npm run dev
- Start the Astro development server to preview your documentation:
-
Build and Deploy
- Once you’re happy with the documentation, build it for production:
Terminal window npm run build - After that, you can deploy the static files in the
dist/
directory to your preferred hosting service.
- Once you’re happy with the documentation, build it for production:
For more customization and features, you can explore the Starlight documentation.