Skip to content

Basics

  • Directorypublic/
  • Directorysrc/
    • Directoryassets/
    • Directorycontent/
      • Directorydocs/
    • content.config.ts
  • astro.config.mjs
  • package.json
  • tsconfig.json
CommandAction
npm installInstalls dependencies
npm run devStarts local dev server at localhost:4321
npm run buildBuild your production site to ./dist/
npm run previewPreview your build locally, before deploying
npm run astro ...Run CLI commands like astro add, astro check
npm run astro -- --helpGet help using the Astro CLI
  1. Create a new .mdx file in src/content/docs/.

  2. Add YAML front matter at the top of the file, otherwise it will not compile.

    ---
    title: title of the document
    description: A description of the subject matter. It is displayed in the generated static page under the top title.
    ---
  1. Create a CSS file, e.g. src/styles/custom.css — the file name is not important.

  2. Update astro.config.mjs to reference your CSS file.

    astro.config.mjs
    customCss: [
    './src/styles/example1.css',
    './src/styles/example2.css',
    ],

Sidebar is configured by the astro.config.mjs file.

sidebar: [
{ label: 'Intro', slug: 'guides/intro' }, // internal page
{ label: 'NASA', link: 'https://nasa.gov' }, // external link
]