vernak2539 / astro-rehype-relative-markdown-links

Rehype Plugin for Astro that allows for usage of relative links between markdown files
https://www.npmjs.com/package/astro-rehype-relative-markdown-links
12 stars 4 forks source link

bug: Content collection name portion of path segment is slugified #15

Closed techfg closed 6 months ago

techfg commented 6 months ago

When a url is transformed, the content collection path segment is being slugified resulting in incorrect path being generated.

For example, in a content collection of /posts.md, in a file post-3.md, the resulting url will be /postsmd/post-3 when it should be `/posts.md/post-3.

Astro does not appear to slugify the content collection segment itself, only the path relative to it.

Repro:

With Proposed Fixes from PR #21:

Steps to repro:

  1. Open repro
  2. Click on Post MD 1
  3. Click on either link under Repro for Issue #15

Expected Result: Link should navigate to /posts.md/post-md-1 or /posts.md/post.md.2 (has a custom slug) depending on which link you clicked.

Actual Result: /posts.md is sluggified to /postsmd resulting in 404

Additional Info: You can see all links that Astro generates on home page under Issue #15 heading

techfg commented 6 months ago

FYI - Edited OP to a Stackblitz to the repro that contains the proposed fixes from #21.

vernak2539 commented 6 months ago

Released in v0.9.0! Thanks!