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

False 'invalid link' errors after upgrading to Astro 5.0.5 + SL 0.30.1 #76

Closed
NeilJS opened this issue Dec 16, 2024 · 6 comments · Fixed by #77
Closed

False 'invalid link' errors after upgrading to Astro 5.0.5 + SL 0.30.1 #76

NeilJS opened this issue Dec 16, 2024 · 6 comments · Fixed by #77

Comments

@NeilJS
Copy link

NeilJS commented Dec 16, 2024

Describe the bug

After upgrading to the new Astro, I am getting "invalid link" errors on some - but not all - pages that previously passed the validation.

  • Seems to be affecting .mdx but not .md files.
  • I cannot see anything wrong with the invalid links.
  • I can copy and paste the link to see that the page exists in the preview or build.

To Reproduce

  1. Before upgrading to Astro 5+, ensure at least one page is .mdx format.
  2. Run the link validator; confirm all links pass.
  3. Upgrade Astro to 5+.
  4. Run the link validator again. Get 'invalid link' errors?

Expected behavior

Valid links should not generate 'invalid link' errors, whether they are on .md or .mdx pages.

How often does this bug happen?

Every time

System Info

No response

Additional Context

No response

@HiDeoo
Copy link
Owner

HiDeoo commented Dec 16, 2024

Thanks for the report.

This plugin is not yet compatible with Starlight 0.30 and Astro 5. I'm currently working on it and it should be available in the next few days.

@NeilJS
Copy link
Author

NeilJS commented Dec 16, 2024

Marvellous. Thank you for the update.

@joshka
Copy link

joshka commented Dec 16, 2024

Same - a workaround that worked in ratatui/ratatui-website#795 was to remove the leading / from the links. This shouldn't be necessary, but hopefully that helps diagnose the underlying issue.

Commit ratatui/ratatui-website@b7e1ccb

@HiDeoo
Copy link
Owner

HiDeoo commented Dec 18, 2024

This should now be fixed in the version 0.14.0 of the plugin that I just published.

I highly recommend to take a look at the changes for potential breaking changes or known issues.

@garysassano
Copy link

Upgrading from 0.12.4 to 0.14.0 reduced my link validation errors from 10 to 4, but the issue still isn't entirely resolved.

I was able to pinpoint the root cause of the problem.
The issue arises when you have an index.md file that contains only frontmatter and no additional content.

For example, if your file looks like this:

./src/content/docs/bugs/index.md

---
title: 🐞 Bugs
---

And you reference it in an .mdx file like [Bugs](/bugs/), then the link validation fails.

However, if you modify the file to include content, like this:

./src/content/docs/bugs/index.md

---
title: 🐞 Bugs
---
foobar

The validation error is resolved.

@HiDeoo
Copy link
Owner

HiDeoo commented Dec 20, 2024

The issue arises when you have an index.md file that contains only frontmatter and no additional content.

This seems to be an Astro regression tracked in withastro/astro#12800

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants