Skip to content

Invalid Link

The invalid link error indicates that an internal link in your Markdown or MDX files does not point to an existing page or asset in your docs site. Common causes include typos, renamed or deleted pages, links to draft pages excluded from production builds, and links to assets that do not exist.

For example, given the following project structure:

  • Directorypublic/
    • whitepaper.pdf
  • Directorysrc/
    • Directorycontent/
      • Directorydocs/
        • Directoryguides/
          • usage.mdx
        • getting-started.md

With 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/)
- [Usage guide](/guides/usage/)
- [Whitepaper](/whitepape.pdf)

Running a production build reports the following errors:

astro build
╭─ getting-started.md
·
7 | /guides/setup/
· ╰── invalid link
9 | /whitepape.pdf
· ╰── invalid link
╭─ ─╮
· Found 2 invalid links in 1 file. ·
╰─ ─╯

To fix invalid link errors, update each broken link so it points to an existing page or asset.

For this example:

  • Update /guides/setup/ to point to an existing page, or create the missing page if it should exist.
  • Update /whitepape.pdf to /whitepaper.pdf so the asset path matches the actual file name.