Missing Trailing Slash
The missing trailing slash error indicates that a link points to an existing page, but the link is missing the trailing slash required by Astro’s trailingSlash option when it is set to 'always'.
If your site uses trailingSlash: 'always', /guides/usage should be written as /guides/usage/.
Example
Section titled “Example”For example, given the following project structure:
Directorysrc/
Directorycontent/
Directorydocs/
Directoryguides/
- installation.md
- usage.mdx
- getting-started.md
- astro.config.mjs
With the following configuration in astro.config.mjs:
import starlight from '@astrojs/starlight'import { defineConfig } from 'astro/config'import starlightLinksValidator from 'starlight-links-validator'
export default defineConfig({ integrations: [ starlight({ plugins: [starlightLinksValidator()], title: 'My Docs', }), ], trailingSlash: 'always',})And the following content in src/content/docs/getting-started.md:
---title: Getting Started---
## Next Steps
- [Usage guide](/guides/usage)- [Installation guide](/guides/installation/)Running a production build reports the following error:
╭─ getting-started.md ·7 | /guides/usage · ╰── missing trailing slash
╭─ ─╮· Found 1 invalid link in 1 file. ·╰─ ─╯How to fix
Section titled “How to fix”To fix missing trailing slash errors, update each affected link so it matches the trailing slash style required by your Astro configuration.
For this example:
- Update
/guides/usageto/guides/usage/.