Skip to content

Add support for checking for broken links #247

@delucis

Description

@delucis

It would be good to offer some basic tooling to ensure the integrity of internal links within sites built with Starlight. Many broken links can make a site frustrating to use.

Some prior art:

  • Astro’s Docs has a complex [link checking script(https://github.com/withastro/docs/blob/main/scripts/lint-linkcheck.ts), which runs against build output and makes sure links are not only not broken, but are in the right language (e.g. no /en/ links on a /fr/ page), ensures links end in a trailing slash (the canonical for that site), don’t use an inaccessible label like “read more”, use a relative path (for links within the site — guarantees functionality in staging contexts), etc.

  • @HiDeoo just published a dedicated Starlight integration for this: starlight-links-validator and left some comments: Fix various docs broken links #246 (comment) (thanks @HiDeoo!)

  • VitePress has an ignoreDeadLinks config option, so presumably checks for them although there’s no documentation.

  • Docusaurus has onBrokenLinks and onBrokenMarkdownLinks config options to control what level of error/warning to show on bubild.

There’s some questions about what built-in tooling for Starlight could look like, what config would be needed etc., but would definitely be cool to explore!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSomething it would be good to improve

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions