Based on the information provided in the knowledge sources, I can help you with setting up a landing page alongside your Starlight documentation in Astro. Here's how you can approach this:
-
Starlight Documentation Setup:
Your approach of moving your documentation into content/docs/ with .md files is correct. This is where Starlight expects your documentation content to be located.
-
Landing Page:
Creating pages/index.astro for your landing page is a good start. This file will indeed create a page at the root of your site.
-
Configuring Starlight:
The issue you're experiencing with your documentation not being available anymore might be related to how Starlight is configured. By default, Starlight assumes it's managing your entire site. To use Starlight for only a portion of your site (like a /docs subdirectory), you need to adjust your configuration.
Here's what you can do:
- Update your
astro.config.mjs file to specify a base path for your documentation:
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
export default defineConfig({
integrations: [
starlight({
title: 'My Project',
base: '/docs',
}),
],
});
-
Move your documentation files:
Instead of putting your docs directly in src/content/docs/, create a subdirectory that matches your base path. For example:
src/content/docs/guides/...
becomes:
src/content/docs/docs/guides/...
This setup should allow you to have both a custom landing page at the root of your site and your Starlight documentation available at /docs.