Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Astro 5 + collection loaders + legacy collections support #2612

Merged
merged 91 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
12fa163
feat: bump many dependencies for Astro v5
HiDeoo Nov 13, 2024
2dffec2
feat: handle mdx peer dep change
HiDeoo Nov 13, 2024
9bb4f5c
fix: handle content layer basic changes
HiDeoo Nov 13, 2024
f84465a
feat: add loaders
HiDeoo Nov 13, 2024
6714593
feat: remove `globalRoutePriority` experimental option
HiDeoo Nov 13, 2024
db6affc
feat: update shiki `css-variables` theme token names
HiDeoo Nov 13, 2024
d7e5dd0
fix: 404 slug
HiDeoo Nov 13, 2024
f1ab9e1
feat: update vitest
HiDeoo Nov 14, 2024
b6907d3
feat: remove user-configurable loader paths
HiDeoo Nov 15, 2024
aa6c6be
chore: update astro version to beta 8
HiDeoo Nov 15, 2024
e2b5173
test: fix vitest workspace configuration
HiDeoo Nov 15, 2024
806ee64
test: remove unnecessary `@ts-expect-error` directives
HiDeoo Nov 15, 2024
a6fe0ae
test: update routing tests for legacy collections
HiDeoo Nov 15, 2024
48191a2
refactor: use `filePath` with git helpers
HiDeoo Nov 15, 2024
f066341
fix: type import
HiDeoo Nov 15, 2024
574ead1
feat: legacy content collections
HiDeoo Nov 15, 2024
7fcc338
fix: edit url
HiDeoo Nov 15, 2024
19cf56d
fix: sidebar autogenerated groups
HiDeoo Nov 15, 2024
d8b0bba
feat: add new and legacy collections support
HiDeoo Nov 15, 2024
a78d975
fix: 404
HiDeoo Nov 15, 2024
5c758c0
ci: test legacy collections
HiDeoo Nov 15, 2024
a51ff9a
test: fix e2e tests
HiDeoo Nov 15, 2024
234c01d
fix: loader with custom `srcDir`
HiDeoo Nov 15, 2024
5aa97a5
fix: 404 `filePath`
HiDeoo Nov 15, 2024
c6d4a9c
fix: `output: 'static'` & `prerender: false` error message
HiDeoo Nov 15, 2024
b47c07f
feat: update examples `tsconfig.json` files
HiDeoo Nov 15, 2024
798bf84
feat: remove `env.d.ts` files
HiDeoo Nov 15, 2024
6041985
docs: update `?raw` code component examples
HiDeoo Nov 15, 2024
b178bf9
chore: remove unnecessary `.gitignore` entry
HiDeoo Nov 15, 2024
4d09de5
fix: update monorepo root `tsconfig.json`
HiDeoo Nov 15, 2024
c225761
fix: 404 `filePath`
HiDeoo Nov 15, 2024
bc6819a
fix: starlight page route data
HiDeoo Nov 15, 2024
b77bd88
fix: docs link validator
HiDeoo Nov 16, 2024
10574aa
fix: basics example
HiDeoo Nov 16, 2024
d7a6b47
fix: tailwind example
HiDeoo Nov 16, 2024
30a2e3f
feat: add markdoc support to docs loader
HiDeoo Nov 16, 2024
96a088b
fix: markdoc example
HiDeoo Nov 16, 2024
4b45a9f
feat: add `// @ts-check` to config files
HiDeoo Nov 16, 2024
a689a34
test: exclude `.astro` files from coverage
HiDeoo Nov 16, 2024
8acd505
test: tweak starlight test coverage thresholds
HiDeoo Nov 16, 2024
2c57f2f
test: disable tailwind test coverate thresholds auto update
HiDeoo Nov 16, 2024
6583163
test: tweak tailwind test coverage thresholds
HiDeoo Nov 16, 2024
214d8b4
fix: boolean data attributes
HiDeoo Nov 17, 2024
d2e5e3d
docs: update link check instructions
HiDeoo Nov 18, 2024
3bae9e3
fix: windows git path issue
HiDeoo Nov 18, 2024
073cfcb
Merge branch 'main' into hd-astro-v5
HiDeoo Nov 19, 2024
9c5dcc3
fix: ignore ssr build directory from root `tsconfig.json`
HiDeoo Nov 19, 2024
1e8edf1
chore: update jsdoc example
HiDeoo Nov 19, 2024
a74c1d1
test: update mocked collection config
HiDeoo Nov 19, 2024
1c5bdb6
Merge branch 'main' into hd-astro-v5
HiDeoo Nov 22, 2024
b56de15
feat: update to astro 5.0.0-beta.10
HiDeoo Nov 22, 2024
344878b
chore: remove fixed bug todo comment
HiDeoo Nov 22, 2024
bf69ba5
test: update test to match fixed types in astro
HiDeoo Nov 22, 2024
97a78a6
feat: add support for `content.config.ts` file
HiDeoo Nov 22, 2024
f22913c
chore: tweak comment
HiDeoo Nov 22, 2024
6c4df31
chore: update `src/content/config.ts` references
HiDeoo Nov 22, 2024
b14aca5
chore: bump astro version to beta 11
HiDeoo Nov 26, 2024
73d6e69
feat: revert mdx integration changes
HiDeoo Nov 26, 2024
4d119e6
fix: collection config import path on windows
HiDeoo Nov 26, 2024
8aa6621
fix: starlight page id for legacy collections
HiDeoo Nov 26, 2024
57c925e
docs: content collection config changes
HiDeoo Nov 26, 2024
71109b8
docs: route data `id` for legacy collections
HiDeoo Nov 26, 2024
5380aba
Merge branch 'main' into hd-astro-v5
HiDeoo Nov 26, 2024
ecd3116
docs: update astro docs links
HiDeoo Nov 26, 2024
0e23e3a
chore: bump astro version to beta 12 and vitest to 2.1.6
HiDeoo Nov 27, 2024
28ca09c
fix: explicitly await some test assertions
HiDeoo Nov 27, 2024
eb8022c
feat: remove prerender check no longer relevant
HiDeoo Nov 27, 2024
3b88a9b
chore: add changesets
HiDeoo Nov 28, 2024
9f75b18
docs: add `legacy.collections`
HiDeoo Dec 3, 2024
f446092
Merge branch 'main' into hd-astro-v5
HiDeoo Dec 3, 2024
2af3ed4
feat: update to astro 5 stable
HiDeoo Dec 3, 2024
ba7d275
feat: update to astro `5.0.2`
HiDeoo Dec 4, 2024
e07dd93
chore: pin vitest version to `2.1.6`
HiDeoo Dec 5, 2024
fc99611
docs: add step for other collections in upgrade guide
HiDeoo Dec 6, 2024
0521ba2
refactor: collection paths
HiDeoo Dec 6, 2024
000efa1
chore: update changeset version
HiDeoo Dec 12, 2024
3f41484
Merge branch 'main' into hd-astro-v5
HiDeoo Dec 13, 2024
803f8a6
refactor: `loader` → `loaders`
HiDeoo Dec 13, 2024
d73e820
chore: deprecate `slug` from route data
HiDeoo Dec 13, 2024
40469ed
docs: fix highlighting
HiDeoo Dec 13, 2024
f9b9731
docs: remove inline code markup
HiDeoo Dec 13, 2024
dcb6095
refactor: collection helpers
HiDeoo Dec 13, 2024
43e5447
feat: normalize content layer IDs
HiDeoo Dec 13, 2024
755a6d3
chore: fix typo
HiDeoo Dec 13, 2024
13c8796
docs: fix local link
HiDeoo Dec 13, 2024
39d6f3b
Merge branch 'main' into hd-astro-v5
HiDeoo Dec 13, 2024
08a74c5
chore: bump `@astrojs/starlight` peer dependency
HiDeoo Dec 13, 2024
a2c7bb3
Clarify
delucis Dec 13, 2024
444d9cf
Withhold information
delucis Dec 13, 2024
0b9a91c
Add changeset subheadings
delucis Dec 13, 2024
fd04220
Merge branch 'main' into hd-astro-v5
delucis Dec 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .changeset/green-suns-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
"@astrojs/starlight": minor
---

Adds support for Astro v5, drops support for Astro v4.

#### Upgrade Astro and dependencies

⚠️ **BREAKING CHANGE:** Astro v4 is no longer supported. Make sure you [update Astro](https://docs.astro.build/en/guides/upgrade-to/v5/) and any other official integrations at the same time as updating Starlight:
delucis marked this conversation as resolved.
Show resolved Hide resolved

```sh
npx @astrojs/upgrade
```

_Community Starlight plugins and Astro integrations may also need to be manually updated to work with Astro v5. If you encounter any issues, please reach out to the plugin or integration author to see if it is a known issue or if an updated version is being worked on._

#### Update your collections

⚠️ **BREAKING CHANGE:** Starlight's internal [content collections](https://docs.astro.build/en/guides/content-collections/), which organize, validate, and render your content, have been updated to use Astro's new Content Layer API and require configuration changes in your project.

1. **Move the content config file.** This file no longer lives within the `src/content/config.ts` folder and should now exist at `src/content.config.ts`.


1. **Edit the collection definition(s).** To update the `docs` collection, a `loader` is now required:

```diff
// src/content.config.ts
import { defineCollection } from "astro:content";
+import { docsLoader } from "@astrojs/starlight/loaders";
import { docsSchema } from "@astrojs/starlight/schema";

export const collections = {
- docs: defineCollection({ schema: docsSchema() }),
+ docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
};
```

If you are using the [`i18n` collection](https://starlight.astro.build/guides/i18n/#translate-starlights-ui) to provide translations for additional languages you support or override our default labels, you will need to update the collection definition in a similar way and remove the collection `type` which is no longer available:

```diff
// src/content.config.ts
import { defineCollection } from "astro:content";
+import { docsLoader, i18nLoader } from "@astrojs/starlight/loaders";
import { docsSchema, i18nSchema } from "@astrojs/starlight/schema";

export const collections = {
- docs: defineCollection({ schema: docsSchema() }),
+ docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
- i18n: defineCollection({ type: 'data', schema: i18nSchema() }),
+ i18n: defineCollection({ loader: i18nLoader(), schema: i18nSchema() }),
};
```

1. **Update other collections.** To update any other collections you may have, follow the [“Updating existing collections”](https://docs.astro.build/en/guides/upgrade-to/v5/#updating-existing-collections) section in the Astro 5 upgrade guide.

If you are unable to make any changes to your collections at this time, including Starlight's default `docs` and `i18n` collections, you can enable the [`legacy.collections` flag](https://docs.astro.build/en/reference/legacy-flags/) to upgrade to v5 without updating your collections. This legacy flag exists to provide temporary backwards compatibility, and will allow you to keep your collections in their current state until the legacy flag is no longer supported.
13 changes: 13 additions & 0 deletions .changeset/polite-snails-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@astrojs/starlight-docsearch': minor
'@astrojs/starlight-tailwind': major
'@astrojs/starlight-markdoc': minor
---

⚠️ **BREAKING CHANGE:** The minimum supported version of Starlight is now 0.30.0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tentatively assuming that this PR will be shipped in the next minor version (0.30.0), may need to be updated if for some reason it's not.


Please use the `@astrojs/upgrade` command to upgrade your project:

```sh
npx @astrojs/upgrade
```
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ jobs:
- run: pnpm i
- name: Test packages
run: pnpm -r test:coverage
- name: Test legacy collections support
working-directory: packages/starlight
run: pnpm test:legacy

e2e-test:
name: 'Run E2E tests (${{ matrix.os }})'
Expand Down Expand Up @@ -149,6 +152,4 @@ jobs:

- name: Build docs site and check links
working-directory: ./docs
run: pnpm build
env:
CHECK_LINKS: true
run: pnpm linkcheck
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,3 @@ test-results/

# Vercel output
.vercel

# Created by @astrojs/check
/src/
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ You should then be able to open <http://localhost:4321> and see your changes.
When adding or translating content in the Starlight docs site, you can check all internal links are valid.
All GitHub PRs are checked this way automatically, but testing locally can help if you want to confirm changes are correct before committing them.

To do this, move into the `docs/` directory from the root of the repo and then build the site with the `CHECK_LINKS` environment variable:
To do this, move into the `docs/` directory from the root of the repo and then run `pnpm linkcheck`:

```sh
cd docs
CHECK_LINKS=true pnpm build
pnpm linkcheck
```

If there are any broken links, the build will fail and log which pages need to be fixed.
Expand Down Expand Up @@ -200,7 +200,7 @@ pnpm test:e2e

#### Test fixtures

Each subdirectory of `packages/starlight/__e2e__/fixtures` should contain the basic files needed to run Starlight (`package.json`, `astro.config.mjs`, a content collection configuration in `src/content/config.ts` and some content to render in `src/content/docs/`).
Each subdirectory of `packages/starlight/__e2e__/fixtures` should contain the basic files needed to run Starlight (`package.json`, `astro.config.mjs`, a content collection configuration in `src/content.config.ts` and some content to render in `src/content/docs/`).

The `testFactory()` helper can be used in a test file to define the fixture which will be built and loaded in a preview server during a set of tests.

Expand Down
1 change: 1 addition & 0 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-check
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import starlightLinksValidator from 'starlight-links-validator';
Expand Down
3 changes: 2 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"build": "astro build",
"preview": "astro preview",
"typecheck": "tsc --noEmit",
"linkcheck": "CHECK_LINKS=true pnpm build --force",
"astro": "astro",
"lunaria:build": "lunaria build",
"grammars": "node grammars/generate.mjs"
Expand All @@ -19,7 +20,7 @@
"@astrojs/starlight": "workspace:*",
"@lunariajs/core": "^0.1.1",
"@types/culori": "^2.1.1",
"astro": "^4.16.10",
"astro": "^5.0.2",
"culori": "^4.0.1",
"sharp": "^0.32.5"
},
Expand Down
8 changes: 6 additions & 2 deletions docs/src/content/config.ts → docs/src/content.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { defineCollection, z } from 'astro:content';
import { docsLoader, i18nLoader } from '@astrojs/starlight/loaders';
import { docsSchema, i18nSchema } from '@astrojs/starlight/schema';

export const collections = {
docs: defineCollection({ schema: docsSchema() }),
docs: defineCollection({
loader: docsLoader(),
schema: docsSchema(),
}),
i18n: defineCollection({
type: 'data',
loader: i18nLoader(),
schema: i18nSchema({
extend: z.object({
'component.preview': z.string().optional(),
Expand Down
8 changes: 4 additions & 4 deletions docs/src/content/docs/components/code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ You can then pass this imported string to the `<Code>` component to include it o
# src/content/docs/example.mdx

import { Code } from '@astrojs/starlight/components';
import importedCode from '/src/env.d.ts?raw';
import importedCode from '/tsconfig.json?raw';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the changes to the TypeScript configuration, I removed all env.d.ts files so this example is no longer working (and relevant?). I switched to showing instead the default (and new) tsconfig.json file for Astro projects (we have a verbatim copy in the basics example).


<Code code={importedCode} lang="ts" title="src/env.d.ts" />
<Code code={importedCode} lang="json" title="tsconfig.json" />
```

import importedCode from '/src/env.d.ts?raw';
import importedCode from '../../../../../examples/basics/tsconfig.json?raw';

<Code slot="preview" code={importedCode} lang="ts" title="src/env.d.ts" />
<Code slot="preview" code={importedCode} lang="json" title="tsconfig.json" />

</Preview>

Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/components/using-components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Components let you easily reuse a piece of UI or styling consistently.
Examples might include a link card or a YouTube embed.
Starlight supports the use of components in [MDX](https://mdxjs.com/) and [Markdoc](https://markdoc.dev/) files and provides some common components for you to use.

[Learn more about building components in the Astro Docs](https://docs.astro.build/en/core-concepts/astro-components/).
[Learn more about building components in the Astro Docs](https://docs.astro.build/en/basics/astro-components/).

## Using a component in MDX

Expand All @@ -30,7 +30,7 @@ import CustomCard from '../../components/CustomCard.astro';
<CustomCard>Components can also contain **nested content**.</CustomCard>
```

Because Starlight is powered by Astro, you can add support for components built with any [supported UI framework (React, Preact, Svelte, Vue, Solid, and Alpine)](https://docs.astro.build/en/core-concepts/framework-components/) in your MDX files.
Because Starlight is powered by Astro, you can add support for components built with any [supported UI framework (React, Preact, Svelte, Vue, Solid, and Alpine)](https://docs.astro.build/en/guides/framework-components/) in your MDX files.
Learn more about [using components in MDX](https://docs.astro.build/en/guides/integrations-guide/mdx/#using-components-in-mdx) in the Astro docs.

## Using a component in Markdoc
Expand Down
8 changes: 4 additions & 4 deletions docs/src/content/docs/de/components/code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ Du kannst diese importierte Zeichenfolge dann an die Komponente `<Code>` überge
# src/content/docs/example.mdx

import { Code } from '@astrojs/starlight/components';
import importedCode from '/src/env.d.ts?raw';
import importedCode from '/tsconfig.json?raw';

<Code code={importedCode} lang="ts" title="src/env.d.ts" />
<Code code={importedCode} lang="json" title="tsconfig.json" />
```

import importedCode from '/src/env.d.ts?raw';
import importedCode from '../../../../../../examples/basics/tsconfig.json?raw';

<Code slot="preview" code={importedCode} lang="ts" title="src/env.d.ts" />
<Code slot="preview" code={importedCode} lang="json" title="tsconfig.json" />

</Preview>

Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/environmental-impact.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,6 @@ These tests with the [Website Carbon Calculator][wcc] compare similar pages buil
[sf]: https://www.sciencefocus.com/science/what-is-the-carbon-footprint-of-the-internet/
[bbc]: https://www.bbc.com/future/article/20200305-why-your-internet-habits-are-not-as-clean-as-you-think
[http]: https://httparchive.org/reports/state-of-the-web
[assets]: https://docs.astro.build/en/guides/assets/
[assets]: https://docs.astro.build/en/guides/images/
[islands]: https://docs.astro.build/en/concepts/islands/
[wcc]: https://www.websitecarbon.com/
8 changes: 4 additions & 4 deletions docs/src/content/docs/es/components/code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ Puedes pasar este string importado al componente `<Code>` para incluirlo en tu p
# src/content/docs/example.mdx

import { Code } from '@astrojs/starlight/components';
import importedCode from '/src/env.d.ts?raw';
import importedCode from '/tsconfig.json?raw';

<Code code={importedCode} lang="ts" title="src/env.d.ts" />
<Code code={importedCode} lang="json" title="tsconfig.json" />
```

import importedCode from '/src/env.d.ts?raw';
import importedCode from '../../../../../../examples/basics/tsconfig.json?raw';

<Code slot="preview" code={importedCode} lang="ts" title="src/env.d.ts" />
<Code slot="preview" code={importedCode} lang="json" title="tsconfig.json" />

</Preview>

Expand Down
8 changes: 4 additions & 4 deletions docs/src/content/docs/fr/components/code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ Vous pouvez ensuite passer cette chaîne importée au composant `<Code>` pour l'
# src/content/docs/example.mdx

import { Code } from '@astrojs/starlight/components';
import importedCode from '/src/env.d.ts?raw';
import importedCode from '/tsconfig.json?raw';

<Code code={importedCode} lang="ts" title="src/env.d.ts" />
<Code code={importedCode} lang="json" title="tsconfig.json" />
```

import importedCode from '/src/env.d.ts?raw';
import importedCode from '../../../../../../examples/basics/tsconfig.json?raw';

<Code slot="preview" code={importedCode} lang="ts" title="src/env.d.ts" />
<Code slot="preview" code={importedCode} lang="json" title="tsconfig.json" />

</Preview>

Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/guides/authoring-content.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ You can highlight `inline code` with backticks.

## Images

Images in Starlight use [Astro’s built-in optimized asset support](https://docs.astro.build/en/guides/assets/).
Images in Starlight use [Astro’s built-in optimized asset support](https://docs.astro.build/en/guides/images/).

Markdown and MDX support the Markdown syntax for displaying images that includes alt-text for screen readers and assistive technology.

Expand Down
21 changes: 11 additions & 10 deletions docs/src/content/docs/guides/i18n.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,16 @@ You can provide translations for additional languages you support — or overrid

<Steps>

1. Configure the `i18n` data collection in `src/content/config.ts` if it isn’t configured already:
1. Configure the `i18n` data collection in `src/content.config.ts` if it isn’t configured already:

```diff lang="js" ins=/, (i18nSchema)/
// src/content/config.ts
import { defineCollection } from 'astro:content';
```diff lang="js" ins=/, (i18nLoader|i18nSchema)/
// src/content.config.ts
import { docsLoader, i18nLoader } from '@astrojs/starlight/loaders';
import { docsSchema, i18nSchema } from '@astrojs/starlight/schema';

export const collections = {
docs: defineCollection({ schema: docsSchema() }),
+ i18n: defineCollection({ type: 'data', schema: i18nSchema() }),
docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
+ i18n: defineCollection({ loader: i18nLoader(), schema: i18nSchema() }),
};
```

Expand Down Expand Up @@ -257,14 +257,15 @@ Add custom keys to your site’s translation dictionaries by setting `extend` in
In the following example, a new, optional `custom.label` key is added to the default keys:

```diff lang="js"
// src/content/config.ts
// src/content.config.ts
import { defineCollection, z } from 'astro:content';
import { docsLoader, i18nLoader } from '@astrojs/starlight/loaders';
import { docsSchema, i18nSchema } from '@astrojs/starlight/schema';

export const collections = {
docs: defineCollection({ schema: docsSchema() }),
docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
i18n: defineCollection({
type: 'data',
loader: i18nLoader(),
schema: i18nSchema({
+ extend: z.object({
+ 'custom.label': z.string().optional(),
Expand All @@ -274,7 +275,7 @@ export const collections = {
};
```

Learn more about content collection schemas in [“Defining a collection schema”](https://docs.astro.build/en/guides/content-collections/#defining-a-collection-schema) in the Astro docs.
Learn more about content collection schemas in [“Defining a collection schema”](https://docs.astro.build/en/guides/content-collections/#defining-the-collection-schema) in the Astro docs.

## Using UI translations

Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/guides/overriding-components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ import Default from '@astrojs/starlight/components/SocialIcons.astro';
When rendering a built-in component inside a custom component:

- Spread `Astro.props` into it. This makes sure that it receives all the data it needs to render.
- Add a [`<slot />`](https://docs.astro.build/en/core-concepts/astro-components/#slots) inside the default component. This makes sure that if the component is passed any child elements, Astro knows where to render them.
- Add a [`<slot />`](https://docs.astro.build/en/basics/astro-components/#slots) inside the default component. This makes sure that if the component is passed any child elements, Astro knows where to render them.

If you are reusing the [`PageFrame`](/reference/overrides/#pageframe) or [`TwoColumnContent`](/reference/overrides/#twocolumncontent) components which contain [named slots](https://docs.astro.build/en/basics/astro-components/#named-slots), you also need to [transfer](https://docs.astro.build/en/basics/astro-components/#transferring-slots) these slots as well.

Expand Down Expand Up @@ -155,4 +155,4 @@ const isHomepage = Astro.props.slug === '';
}
```

Learn more about conditional rendering in [Astro’s Template Syntax guide](https://docs.astro.build/en/core-concepts/astro-syntax/#dynamic-html).
Learn more about conditional rendering in [Astro’s Template Syntax guide](https://docs.astro.build/en/basics/astro-syntax/#dynamic-html).
7 changes: 3 additions & 4 deletions docs/src/content/docs/guides/project-structure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ description: Learn how to organize files in your Starlight project.

This guide will show you how a Starlight project is organized and what the different files in your project do.

Starlight projects generally follow the same file and directory structure as other Astro projects. See [Astro’s project structure documentation](https://docs.astro.build/en/core-concepts/project-structure/) for more detail.
Starlight projects generally follow the same file and directory structure as other Astro projects. See [Astro’s project structure documentation](https://docs.astro.build/en/basics/project-structure/) for more detail.

## Files and directories

- `astro.config.mjs` — The Astro configuration file; includes the Starlight integration and configuration.
- `src/content/config.ts` — Content collections configuration file; adds Starlight’s frontmatter schemas to your project.
- `src/content.config.ts` — Content collections configuration file; adds Starlight’s frontmatter schemas to your project.
- `src/content/docs/` — Content files. Starlight turns each `.md`, `.mdx` or `.mdoc` file in this directory into a page on your site.
- `src/content/i18n/` (optional) — Translation data to support [internationalization](/guides/i18n/).
- `src/` — Other source code and files (components, styles, images, etc.) for your project.
Expand Down Expand Up @@ -39,8 +39,7 @@ import { FileTree } from '@astrojs/starlight/components';
- 01-getting-started.md
- 02-advanced.md
- index.mdx
- config.ts
- env.d.ts
- content.config.ts
- astro.config.mjs
- package.json
- tsconfig.json
Expand Down
11 changes: 6 additions & 5 deletions docs/src/content/docs/guides/site-search.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,19 @@ Add translations of the modal UI for your language using Starlight’s built-in

<Steps>

1. Extend Starlight’s `i18n` content collection definition with the DocSearch schema in `src/content/config.ts`:
1. Extend Starlight’s `i18n` content collection definition with the DocSearch schema in `src/content.config.ts`:

```js ins={4} ins=/{ extend: .+ }/
// src/content/config.ts
```js ins={5} ins=/{ extend: .+ }/
// src/content.config.ts
import { defineCollection } from 'astro:content';
import { docsLoader, i18nLoader } from '@astrojs/starlight/loaders';
import { docsSchema, i18nSchema } from '@astrojs/starlight/schema';
import { docSearchI18nSchema } from '@astrojs/starlight-docsearch/schema';

export const collections = {
docs: defineCollection({ schema: docsSchema() }),
docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
i18n: defineCollection({
type: 'data',
loader: i18nLoader(),
schema: i18nSchema({ extend: docSearchI18nSchema() }),
}),
};
Expand Down
Loading
Loading