Skip to content

Invalid Link to Custom Page

The invalid link to custom page error indicates that a link points to a known custom page route that the plugin cannot validate with the same level of detail as regular documentation pages.

If needed, use the exclude option to ignore these errors for expected custom pages.

For example, given the following project structure:

  • Directorysrc/
    • Directorycontent/
      • Directorydocs/
        • Directoryguides/
          • setup.mdx
        • getting-started.md
    • Directorypages/
      • custom-page.astro

And the following content in src/content/docs/getting-started.md:

src/content/docs/getting-started.md
---
title: Getting Started
---
## Next Steps
- [Setup guide](/guides/setup/)
- [Custom page](/custom-page/)

Running a production build reports the following error:

astro build
╭─ getting-started.md
·
7 | /custom-page/
· ╰── invalid link to custom page
╭─ ─╮
· Found 1 invalid link in 1 file. ·
╰─ ─╯

Use the exclude option to ignore these errors when links to custom pages are expected.

For this example:

  • Exclude /custom-page/ using the exclude option.

    starlightLinksValidator({
    exclude: ['/custom-page/'],
    })