-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
Inconsistent Behavior of Links in Starlight | Frontmatter Prev and Next #1886
Comments
Thank you for the detailed issue and reproduction @DrNeonsy — extremely helpful! This behaviour looks like a bug to me although I don’t immediately understand why the different pages are handled differently. My expectation would be that the value of In that case, the “correct” frontmatter would look like (the leading next:
label: example ref
link: /my-repo/reference/example/ First things first though is to work out why those two seemingly identical pages behave differently 😅 |
Thank you, @delucis, for taking the time to review my issue. I appreciate your assistance in this matter. To provide more context, I'd like to share a specific instance from my actual documentation where I've encountered this inconsistent behavior. Despite managing to resolve most of the link-related issues, there's one page that continues with the problematic behavior. ---
title: Numbers
prev:
label: Output
link: /Python-Note-Collection/python/basics/output
next:
label: Datatypes
link: /python/basics/datatypes
--- This page, in particular, seems to be behaving differently from the rest, and I'm unsure why. As you can see, the |
Had a bit of free time so I started investigating it. I did not have time yet to start a PR but wanted to share my findings. If we take your last example and remove the When the
In this specific case, we want to use the provided
|
Thank you for your detailed investigation @HiDeoo. I've also noticed that the very last page seems to be the one acting up during my tests, when it comes to the next link, which is consistent with the minimal reproduction example. However, I must admit that my understanding of the underlying code is limited, so my testing has been somewhat superficial. Therefore, I once again want to thank you for your findings. I'm looking forward to how this will play out with keen interest. |
Amazing investigation @HiDeoo! Glad that we could trace it down to the cases where a prev/next link would not otherwise exist. I think that aligns with my expectation then: we accidentally introduced
I think that’s a risky path to go down — not impossible for there to be situations like |
Hello again, it's been a while 😄 I've been meaning to ask if there are any updates regarding this issue 🙃 |
What version of
starlight
are you using?0.22.4
What version of
astro
are you using?4.8.6
What package manager are you using?
pnpm
What operating system are you using?
Windows
What browser are you using?
Brave
Describe the Bug
Issue: Inconsistent Behavior of Prev and Next Links in Starlight
Description
I've been experimenting with Starlight for a couple of days and have recently set up a project hosted on GitHub Pages. I've noticed that the behavior of the
Prev
andNext
links is inconsistent and I'm unsure why this is happening.Details
The issue is that sometimes the links work as expected, and other times they don't. It seems that sometimes they need to be prefixed with the Astro config's
base
value, and other times they automatically prefix themselves.To understand why the behavior changes, I created a fresh template install. In this template, I have three files in an auto-generated directory. Each file uses the exact same link. The link in
three.md
works, but the links inone.md
andtwo.md
do not.In my actual documentation, I've tried prefixing the frontmatter links with the base value. Everything works with this prefixing, except for one file. I've also noticed odd differences where a link works in one test run and not in another. It seems whether the link is treated as relative or absolute, and whether it needs the base as a prefix, changes unpredictably.
Steps to Reproduce
/src/content/docs/myfiles
within the new project.one.md
,two.md
,three.md
) and add them to the sidebar config as auto-generated directory.three.md
works, but the links inone.md
andtwo.md
do not.Expected Behavior
The links should consistently work across all files and should either all require manual prefixing with the base value or non of the links require the prefixing.
Actual Behavior
The links work inconsistently. Sometimes they require manual prefixing with the base value, and other times they do not.
I believe this is not the intended behavior, hence I'm opening this issue. Any help or guidance would be greatly appreciated.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-rzkjm9?file=astro.config.mjs
Participation
The text was updated successfully, but these errors were encountered: