Installation
import { Tabs, TabItem, Steps, Badge, FileTree } from ‘@astrojs/starlight/components’;
Requirements
Section titled “Requirements”Before using this tool, ensure you have:
1. Node.js
Section titled “1. Node.js”- Version: 18.0.0 or higher
- Check:
node --version - Download: nodejs.org
2. Astro Starlight Project
Section titled “2. Astro Starlight Project”This tool is specifically designed for Astro projects using the Starlight documentation theme.
Check if you have Starlight:
cat package.json | grep starlightDon’t have Starlight yet? Create a new Starlight project
3. Google Analytics 4 (Optional)
Section titled “3. Google Analytics 4 (Optional)”- Get a GA4 Measurement ID from Google Analytics
- Format:
G-XXXXXXXXXX - Can be added later if you don’t have one yet
Installation Methods
Section titled “Installation Methods”```bashnpx astro-starlight-docs-template init```
**Advantages:**- Always uses the latest version- No global package pollution- One-time usage optimized```bashnpm install -g astro-starlight-docs-template```
Then run:
```bashastro-starlight-docs-template init```
**Advantages:**- Faster subsequent runs- Works offline (after first install)- Shorter command```bashnpm install --save-dev astro-starlight-docs-template```
Add to package.json scripts:
```json{ "scripts": { "optimize": "astro-starlight-docs-template init" }}```
Run with:
```bashnpm run optimize```
**Advantages:**- Version locked in package.json- Team members get same version- CI/CD friendlyVerification
Section titled “Verification”After running the optimizer, verify installation:
-
Check created files
- public/ - cookie-consent.js - llms.txt (if enabled) - src/ - components/ - overrides/ - Footer.astro (if enabled) - ASTRO_DOCS_OPTIMIZER.md -
Check modified files
Terminal window # Should contain Google Analytics and Consent Modecat astro.config.mjs | grep gtag -
Run dev server
Terminal window npm run dev -
Verify in browser
Open
http://localhost:4321and check:- Cookie banner appears (if in GDPR region)
- Footer has cookie settings link (if custom footer enabled)
- Google Analytics script loads in browser DevTools
Package Integrity
Section titled “Package Integrity”This package is published with provenance attestations, meaning you can cryptographically verify it came from the official GitHub repository.
npm view astro-starlight-docs-template dist.attestationsThis proves the package was:
- Built from the official GitHub repository
- Published via GitHub Actions (not manual)
- Not tampered with after build
System Requirements
Section titled “System Requirements”| Requirement | Minimum | Recommended |
|---|---|---|
| Node.js | 18.0.0 | 20.x LTS |
| npm | 7.0.0 | 10.x |
| Disk Space | 10 MB | 50 MB |
| RAM | 512 MB | 1 GB |
| OS | Windows 10, macOS 10.15, Linux | Any recent version |
Troubleshooting Installation
Section titled “Troubleshooting Installation”Next Steps
Section titled “Next Steps”- Quick Start Guide - Run the optimizer
- Configuration - Customize the setup
- Features Overview - Learn what you get