Skip to content

Commit 9b9ad7e

Browse files
committed
compile
1 parent 99ac2fa commit 9b9ad7e

File tree

17 files changed

+314
-9
lines changed

17 files changed

+314
-9
lines changed

astro.config.mjs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,26 @@ export default defineConfig({
1818
},
1919
sidebar: [
2020
{
21-
label: 'Guides',
22-
items: [
23-
{ label: 'Example Guide', slug: 'guides/example' },
24-
],
21+
label: '1.x',
22+
autogenerate: { directory: '1.x' },
2523
},
2624
{
27-
label: 'Reference',
28-
autogenerate: { directory: 'reference' },
25+
label: '2.x',
26+
autogenerate: { directory: '2.x' },
27+
},
28+
{
29+
label: '3.x',
30+
autogenerate: { directory: '3.x' },
31+
},
32+
{
33+
label: '4.x',
34+
autogenerate: { directory: '4.x' },
2935
},
3036
],
37+
components: {
38+
Footer: './docs/components/Footer.astro',
39+
Sidebar: './docs/components/Sidebar.astro',
40+
},
3141
customCss: ['./docs/tailwind.css'],
3242
}),
3343
tailwind({

docs/components/Footer.astro

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
import EditLink from 'virtual:starlight/components/EditLink'
3+
---
4+
5+
<footer class="sl-flex">
6+
<div class="meta sl-flex">
7+
<EditLink />
8+
</div>
9+
</footer>
10+
11+
<style>
12+
footer {
13+
flex-direction: column;
14+
gap: 1.5rem;
15+
}
16+
17+
.meta {
18+
gap: 0.75rem 3rem;
19+
justify-content: space-between;
20+
flex-wrap: wrap;
21+
margin-top: 3rem;
22+
font-size: var(--sl-text-sm);
23+
color: var(--sl-color-gray-3);
24+
}
25+
26+
.meta > :global(p:only-child) {
27+
margin-inline-start: auto;
28+
}
29+
</style>

docs/components/Sidebar.astro

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
import MobileMenuFooter from 'virtual:starlight/components/MobileMenuFooter'
3+
import SidebarPersister from '@astrojs/starlight/components/SidebarPersister.astro'
4+
import SidebarSublist from '@astrojs/starlight/components/SidebarSublist.astro'
5+
import { getVersionFromId } from '../utilities/versioning'
6+
7+
const { id, sidebar } = Astro.locals.starlightRoute
8+
9+
const sublist = sidebar.find((group) => group.label === getVersionFromId(id))?.entries ?? []
10+
---
11+
12+
<SidebarPersister>
13+
<SidebarSublist sublist={sublist} />
14+
</SidebarPersister>
15+
16+
<div class="md:sl-hidden">
17+
<MobileMenuFooter />
18+
</div>

docs/content.config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import { defineCollection } from 'astro:content'
22
import { docsLoader } from '@astrojs/starlight/loaders'
33
import { docsSchema } from '@astrojs/starlight/schema'
4+
import { glob } from 'astro/loaders'
45

56
export const collections = {
6-
docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
7+
docs: defineCollection({ loader: glob({
8+
pattern: `**/[^_]*.{md,mdx}`,
9+
base: './docs/content/docs',
10+
generateId: ({ entry }) => entry.split('.').slice(0, -1).join('.'),
11+
}), schema: docsSchema() }),
712
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ hero:
1515
</span>
1616
tagline: Congrats on setting up a new Starlight project!
1717
image:
18-
file: ../../assets/houston.webp
18+
file: ../../../assets/houston.webp
1919
actions:
2020
- text: Example Guide
21-
link: /docs/guides/example/
21+
link: /docs/1.x/guides/example
2222
icon: right-arrow
2323
- text: Read the Starlight docs
2424
link: https://starlight.astro.build
File renamed without changes.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: Example Guide
3+
description: A guide in my new Starlight docs site.
4+
---
5+
6+
Guides lead a user through a specific task they want to accomplish, often with a sequence of steps.
7+
Writing a good guide requires thinking about what your users are trying to do.
8+
9+
## Further reading
10+
11+
- Read [about how-to guides](https://diataxis.fr/how-to-guides/) in the Diátaxis framework

docs/content/docs/2.x/index.mdx

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
title: Welcome to Starlight
3+
description: Get started building your docs site with Starlight.
4+
template: splash
5+
hero:
6+
title: |
7+
Welcome to Starlight with
8+
<span
9+
class="font-black text-transparent
10+
bg-clip-text bg-gradient-to-b
11+
from-accent-700 to-accent-400
12+
dark:from-accent-500 dark:to-accent-200"
13+
>
14+
Tailwind
15+
</span>
16+
tagline: Congrats on setting up a new Starlight project!
17+
image:
18+
file: ../../../assets/houston.webp
19+
actions:
20+
- text: Example Guide
21+
link: /docs/2.x/guides/example
22+
icon: right-arrow
23+
- text: Read the Starlight docs
24+
link: https://starlight.astro.build
25+
icon: external
26+
variant: minimal
27+
---
28+
29+
import { Card, CardGrid } from '@astrojs/starlight/components'
30+
31+
## Next steps
32+
33+
<CardGrid stagger>
34+
<Card
35+
title="Update content"
36+
icon="pencil"
37+
>
38+
Edit `src/content/docs/index.mdx` to see this page change.
39+
</Card>
40+
<Card
41+
title="Add new content"
42+
icon="add-document"
43+
>
44+
Add Markdown or MDX files to `src/content/docs` to create new pages.
45+
</Card>
46+
<Card
47+
title="Configure your site"
48+
icon="setting"
49+
>
50+
Edit your `sidebar` and other config in `astro.config.mjs`.
51+
</Card>
52+
<Card
53+
title="Read the docs"
54+
icon="open-book"
55+
>
56+
Learn more in [the Starlight Docs](https://starlight.astro.build/).
57+
</Card>
58+
</CardGrid>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: Example Reference
3+
description: A reference page in my new Starlight docs site.
4+
---
5+
6+
Reference pages are ideal for outlining how things work in terse and clear terms.
7+
Less concerned with telling a story or addressing a specific use case, they should give a comprehensive outline of what your documenting.
8+
9+
## Further reading
10+
11+
- Read [about reference](https://diataxis.fr/reference/) in the Diátaxis framework

0 commit comments

Comments
 (0)