Skip to content

Installation

import { Tabs, TabItem, Steps, Badge, FileTree } from ‘@astrojs/starlight/components’;

Before using this tool, ensure you have:

  • Version: 18.0.0 or higher
  • Check: node --version
  • Download: nodejs.org

This tool is specifically designed for Astro projects using the Starlight documentation theme.

Check if you have Starlight:

Terminal window
cat package.json | grep starlight

Don’t have Starlight yet? Create a new Starlight project

  • Get a GA4 Measurement ID from Google Analytics
  • Format: G-XXXXXXXXXX
  • Can be added later if you don’t have one yet
No installation required! Run directly:
```bash
npx astro-starlight-docs-template init
```
**Advantages:**
- Always uses the latest version
- No global package pollution
- One-time usage optimized
Install once, use everywhere:
```bash
npm install -g astro-starlight-docs-template
```
Then run:
```bash
astro-starlight-docs-template init
```
**Advantages:**
- Faster subsequent runs
- Works offline (after first install)
- Shorter command
Add to your project:
```bash
npm install --save-dev astro-starlight-docs-template
```
Add to package.json scripts:
```json
{
"scripts": {
"optimize": "astro-starlight-docs-template init"
}
}
```
Run with:
```bash
npm run optimize
```
**Advantages:**
- Version locked in package.json
- Team members get same version
- CI/CD friendly

After running the optimizer, verify installation:

  1. Check created files

    - public/ - cookie-consent.js - llms.txt (if enabled) - src/ - components/ - overrides/ - Footer.astro (if enabled) - ASTRO_DOCS_OPTIMIZER.md
  2. Check modified files

    Terminal window
    # Should contain Google Analytics and Consent Mode
    cat astro.config.mjs | grep gtag
  3. Run dev server

    Terminal window
    npm run dev
  4. Verify in browser

    Open http://localhost:4321 and check:

    • Cookie banner appears (if in GDPR region)
    • Footer has cookie settings link (if custom footer enabled)
    • Google Analytics script loads in browser DevTools

This package is published with provenance attestations, meaning you can cryptographically verify it came from the official GitHub repository.

Terminal window
npm view astro-starlight-docs-template dist.attestations

This proves the package was:

  • Built from the official GitHub repository
  • Published via GitHub Actions (not manual)
  • Not tampered with after build
RequirementMinimumRecommended
Node.js18.0.020.x LTS
npm7.0.010.x
Disk Space10 MB50 MB
RAM512 MB1 GB
OSWindows 10, macOS 10.15, LinuxAny recent version