- Docs
- Starter demo
Starter demo
Find the demo header, navigation, homepage, second page and footer, then adapt their source for your site.
Start with a working composition
The interactive installer selects welcome by default. It supplies two static
pages with a shared header, active navigation and footer. This is a source
example of the distribution’s conventions, ready to edit. --minimal leaves it
out and creates a core homepage instead.
To select the demo explicitly:
npm
npx @samline/astro my-site --yes --deploy static --features welcomepnpm
pnpm dlx @samline/astro my-site --yes --deploy static --features welcomeBun
bunx @samline/astro my-site --yes --deploy static --features welcomeFollow the source
| Open | Change |
|---|---|
src/pages/[...locale]/index.astro | Which sections compose the homepage |
src/pages/[...locale]/demo.astro | The second page and its metadata |
src/sections/DemoHeader/ | Header layout, links and current-page state |
src/sections/Welcome/ | Homepage content |
src/sections/DemoPage/ | The second page’s content |
src/sections/DemoFooter/ | Footer content |
src/i18n/dictionaries/<locale>/welcome/ | Demo text |
src/i18n/dictionaries/<locale>/navigation/ | Navigation labels |
Main.astro owns the document, main landmark and shared header/navigation/footer.
It renders DemoHeader and DemoFooter by default when the demo is selected at
creation. Ordinary routes only pass metadata and content sections, so new pages
and errors inherit the same chrome automatically. Named header/footer slots are
reserved for exceptional overrides. Each content section composes reusable
components. The generated
src/sections/Welcome/README.md explains that composition beside the source.
Check the two pages
Run the generated development command and open /, then /demo. The header
marks the current navigation link with aria-current="page". With another active
language, visit that locale’s paths as well. The default language has no prefix;
other active languages do. The language picker keeps the current demo page when
switching languages.
Theme Switch and LanguagePicker appear in the initial header only when their integrations are selected. They are independent choices; the demo does not install them for you. Adding one later makes its component available, and you decide where to mount it. See integration choices.
Adapt it to your site
Replace the demo dictionary copy, then edit its owning sections. Add page-specific
content under src/sections, and keep shared primitives under src/components.
New routes use <Main> with their metadata and content sections; do not repeat
header/footer imports or mounts. Customize Main’s shared imports once for the
whole site. Mount global panels/widgets in the layout and use body-end for
exceptional trailing UI, rather than using the footer override as a catch-all. Project conventions explains the responsibilities;
the Section reference explains its local
props and links to related components.
If you started without the demo, add welcome supplies its sections and /demo
route plus a dedicated Demo layout while leaving your Main and homepage intact.
That feature layout owns the demo’s exceptional chrome overrides. Read the generated README before
deliberately changing your homepage to use it. The installer reports conflicting
files instead of replacing them.
An older or customized Main must have one static named header slot and one
static named footer slot around its main content. If either is missing, adding
the demo stops without changing any files. Review the intended placement and add
the slots explicitly before retrying.
The demo uses native Astro routing and localization. Its page paths match across languages; it does not invent translated API/CMS slugs. Refer to Astro’s routing and internationalization guides for framework behavior. Our language guide explains the distribution’s dictionary setup and translated-content limits.