|
2 | 2 | title: Astro Vitesse
|
3 | 3 | display: 'Give your pages an elegant touch with Astro Vitesse'
|
4 | 4 | description: 'Give your pages an elegant touch with Astro Vitesse'
|
| 5 | +tocAlwaysOn: true |
5 | 6 | ---
|
6 | 7 |
|
7 | 8 | import Card from '@/components/Card.astro'
|
8 | 9 | import SponsorButton from '@/components/SponsorButton.astro'
|
9 | 10 | import LinkWithIcon from '@/components/LinkWithIcon.astro'
|
10 | 11 |
|
| 12 | +[[toc]] |
| 13 | + |
11 | 14 | Everything you need to create a stunning website. Fast, affordable and easy to use.
|
12 | 15 |
|
13 | 16 | It's inspired by <LinkWithIcon href="https://antfu.me" iconUrl="https://antfu.me/favicon.svg">antfu.me</LinkWithIcon> <br />
|
@@ -36,6 +39,92 @@ Astro Vitesse ships as a framework-agnostic, complete solution. Extend with Reac
|
36 | 39 |
|
37 | 40 | </div>
|
38 | 41 |
|
| 42 | +## Set up Astro Vitesse |
| 43 | + |
| 44 | +To follow this guide, you’ll need an existing Astro project. |
| 45 | + |
| 46 | +### Add the Astro Vitesse integration |
| 47 | + |
| 48 | +Astro Vitesse is an [Astro integration](https://docs.astro.build/en/guides/integrations-guide/). Add it to your site by running the `astro add` command in your project’s root directory: |
| 49 | + |
| 50 | +```sh |
| 51 | +npx astro add starlight |
| 52 | +``` |
| 53 | + |
| 54 | +This will install the required dependencies and add Starlight to the `integrations` array in your Astro config file. |
| 55 | + |
| 56 | +### Configure the integration |
| 57 | + |
| 58 | +The Astro Vitesse integration is configured in your `astro.config.mjs` file. |
| 59 | + |
| 60 | +Add a `title` to get started: |
| 61 | + |
| 62 | +```js |
| 63 | +import { defineConfig } from 'astro' |
| 64 | +import vitesse from 'astro-vitesse' |
| 65 | + |
| 66 | +export default defineConfig({ |
| 67 | + integrations: [ |
| 68 | + vitesse({ |
| 69 | + title: 'My Site', |
| 70 | + }) |
| 71 | + ] |
| 72 | +}) |
| 73 | +``` |
| 74 | + |
| 75 | +### Configure UnoCSS |
| 76 | + |
| 77 | +Astro Vitesse uses [UnoCSS](https://unocss.dev/) for styling. To configure UnoCSS, create a `unocss.config.ts` file in your project’s root directory: |
| 78 | + |
| 79 | +```ts |
| 80 | +import { defineConfig } from 'astro-vitesse/theme' |
| 81 | + |
| 82 | +export default defineConfig({}) |
| 83 | +``` |
| 84 | + |
| 85 | +### Configure content collections |
| 86 | + |
| 87 | +Astro Vitesse is built on top of Astro’s [content collections](https://docs.astro.build/en/guides/content-collections/), which are configured in the `src/content/config.ts` file. |
| 88 | + |
| 89 | +Create or update the content config file, adding a `pages` collection that uses Starlight’s `pagesSchema`: |
| 90 | + |
| 91 | +```ts |
| 92 | +import { defineCollection } from 'astro:content' |
| 93 | +import { pagesSchema } from 'astro-vitesse/schema' |
| 94 | + |
| 95 | +export const collections = { |
| 96 | + pages: defineCollection({ schema: pagesSchema() }), |
| 97 | +} |
| 98 | +``` |
| 99 | + |
| 100 | +### Add content |
| 101 | + |
| 102 | +Astro Vitesse is now configured and it’s time to add some content! |
| 103 | + |
| 104 | +Create a `src/content/pages/` directory and start by adding an `index.md` file. |
| 105 | +This will be the homepage of your new site: |
| 106 | + |
| 107 | +```mdx |
| 108 | +--- |
| 109 | +title: Welcome to Astro Vitesse |
| 110 | +description: 'Give your pages an elegant touch with Astro Vitesse' |
| 111 | +--- |
| 112 | + |
| 113 | +Welcome to my website! |
| 114 | +``` |
| 115 | + |
| 116 | +Astro Vitesse uses file-based routing, which means every Markdown, MDX, or Markdoc file in `src/content/pages/` will turn into a page on your site. Frontmatter metadata (the `title` and `description` fields in the example above) can change how each page is displayed. |
| 117 | + |
| 118 | +## Start the development server |
| 119 | + |
| 120 | +When working locally, [Astro’s development server](https://docs.astro.build/en/reference/cli-reference/#astro-dev) lets you preview your work and automatically refreshes your browser when you make changes. |
| 121 | + |
| 122 | +Inside your project directory, run the following command to start the development server: |
| 123 | + |
| 124 | +```sh |
| 125 | +npm run dev |
| 126 | +``` |
| 127 | + |
39 | 128 | <div class="flex-auto"></div>
|
40 | 129 |
|
41 | 130 | ---
|
|
0 commit comments