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

bug: markdown links to files outside of a content collection directory should not be transformed #57

Open
techfg opened this issue Apr 28, 2024 · 0 comments · May be fixed by #58
Open

Comments

@techfg
Copy link
Contributor

techfg commented Apr 28, 2024

As mentioned in #26, currently the plugin transforms any relative markdown link in any markdown file (e.g., even if it's in the page directory or in the content directory and points to a location outside of content directory).

The decision outlined in #26 still needs to be made with regards to what situations are officially supported and what expected behavior should be, however currently, the plugin assumes that markdown links (regardless of current file location) reference markdown files within a content collection directory. Given this, any relative link that would otherwise be considered valid, should be further restricted to being a relative location within a content collection directory, either in the same collection or another collection.

Assuming PR #49 is merged (and preferably #50 merged and #53 implemented), cross collection references should be reliable, however references to a location outside of a content collection directory will still not work and are not currently supported given existing behavior.

Repro: https://stackblitz.com/edit/withastro-astro-xtq8zt

Steps to reproduce:

  1. Navigate to https://stackblitz.com/edit/withastro-astro-xtq8zt
  2. Click on (or inspect via dev tools) the links for Site Index and Site Test Page
  3. Navigate to Docs Index
  4. Click on (or inspect via dev tools) the links for Site Index and Site Test Page

Expected Behavior:
Link is not transformed because linked markdown file is located outside of a content collection directory

Actual Behavior:
Links are transformed to /pages and /pages/testpage and 404

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