-
Notifications
You must be signed in to change notification settings - Fork 4
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
bug: Incorrectly strips index
from content collection root index page
#16
Comments
techfg
added a commit
to techfg/astro-rehype-relative-markdown-links
that referenced
this issue
Apr 7, 2024
techfg
added a commit
to techfg/astro-rehype-relative-markdown-links
that referenced
this issue
Apr 7, 2024
This was referenced Apr 7, 2024
FYI - Edited OP to a Stackblitz to the repro that contains the proposed fixes from #21. |
vernak2539
pushed a commit
that referenced
this issue
Apr 11, 2024
Released in v0.9.0! Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When a content collection has a page in the root (e.g.,
/collection/index.md
), the slug should remainindex
unless there is a custom slug defined and if the custom slug is empty string (``), it should be treated as a directory reference and resulting url contain a/
at end. For subdirectories (e.g., `/collection/subdir/index.md`), index should be stripped.Found this issue and confirmed behavior that Astro itself does not strip
index
for root pages in a collection unless custom slug is defined.Repro:
With Proposed Fixes from PR #21:
Steps to reproduce:
Post 1
linkGo to Other Stuff Index
underRepro for Issue #16
Expected Behavior:
Link should navigate to
/otherstuff/index
Actual Behavior:
index
is stripped and link results in 404Post 1
Go to Posts Index
Expected Behavior:
Link should be
/posts/
since it contains a custom slug of empty string (''
)Actual Behavior:
Link is
/posts
without the trailing slashAdditional Info:
Go to Other Stuff Subdir Index
works asindex
is properly strippedGo to Posts Index
works but the url is wrong (see step 4 & 5) - The existing code does a boolean compare on slug to determine if a custom slug exists but empty string evaluates to false so its treated as not having a custom slugGo to Other Stuff 2 Index
works as a custom slug ofmyindex
is defined and it is properly detected and transformedIssue #16
headingindex
files was added in Processindex.md
files correctly + addcontentPath
option #3 based on Does not work with index pages #2The text was updated successfully, but these errors were encountered: