Closed robmunger closed 2 months ago
Thanks for your feedback.
If I build the site without starlight-links-validator, the site builds and the links work properly, whether the file is named with an upper or lower-case i.
This is correct, altho this validator is not only caring about the project building and links working but also by design enforces some other rules, e.g. errors on fallback pages, inconsistent locales, relative links, etc.
I like using PascalCase for my .mdx files because I can read them more easily, so I like the flexibility provided by vanilla Astro to name the file Index.mdx.
Some of the rules I mentioned above have options to be disabled, but the one you're facing is not one of them.
Personally, I think this very specific case should not deserve a new option as it's a very specific case and can also be very confusing for other users/contributors.
I may be entirely wrong so I'll keep an eye on this issue to see if more people are facing the same problem and re-evaluate my opinion if necessary.
In the meantime, I think using the exclude
option would be a good workaround as you know the index page exists and you're fine with it being PascalCase.
export default defineConfig({
integrations: [
starlight({
plugins: [
starlightLinksValidator({
exclude: ["/"]
}),
],
}),
],
})
Funny. I just wanted to create an issue about a link to "/" too ;-) I am using a documentation in which I use / as the first page of the content ("getting started") instead of using the frontend page. https://ngx-translate.org/
Thanks for pointing out that great workaround! I'll use it. I really like that excluding that page doesn't prevent the software from identifying bad links to anchors on that page.
I wonder if it might be helpful to have a different error message when a link is rejected because the source code file name doesn't follow case conventions. Is that something you'd consider?
Describe the bug
This is super minor - an annoyance, really.
If the site homepage is named Index.md instead of index.md, the site works fine if starlight-links-validator isn't used.
However, if starlight-links-validator is used, it will identify all links to / as invalid and will prevent the site from building.
To Reproduce
[home page](/)
to /src/content/docs/guides/example.md[AstroUserError] Links validation failed.