#How to have landing page + doc with astro

5 messages · Page 1 of 1 (latest)

tired schooner
#

Unable to find doc about it.

I started with the starlight template, and moved my doc into content/docs/ with .md files and added an header for each .md files.
Now I made the directory pages/index.astro

However, my documentation is not available anymore. I don't understand how to configure it. And I didn't find in the doc, neither with GPT.

Help thank you

brittle yachtBOT
#

Hi @tired schooner. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

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:

  1. 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.

  2. 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.

  3. 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:

  1. 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',  // This tells Starlight to serve docs at /docs
    }),
  ],
});
  1. 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.

#

For more detailed information on this setup, you can refer to:

If you're still experiencing issues after making these changes, it might be helpful to review your project structure and ensure all paths are correct. If the problem persists, you may need to provide more details about your specific setup for further troubleshooting.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@tired schooner Kapa.ai is still learning and improving, please let me know how I did by reacting below.