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

Supporting relative paths in InputPathToUrlTransformPlugin #3417

Closed
xplosionmind opened this issue Aug 17, 2024 · 2 comments
Closed

Supporting relative paths in InputPathToUrlTransformPlugin #3417

xplosionmind opened this issue Aug 17, 2024 · 2 comments

Comments

@xplosionmind
Copy link

Is your feature request related to a problem? Please describe.

If I want to add a link in a template, linking to another template in the same directory, using InputPathToUrlTransformPlugin, it would look like this (Example 1a):

<!-- content of inputdir/subdirectory/sub-subdirectory/template-1.md -->
[link to template-2](subdirectory/sub-subdirectory/template-2.md)

Nevertheless, since the path relative to the input directory is very long, it would be great if the plugin supported relative paths! (a.k.a. paths relative to the present template)

Describe the solution you'd like

It would be great if the InputPathToUrlTransformPlugin could support links relative to the current template.

Example 1b:

<!-- content of inputdir/subdirectory/sub-subdirectory/template-1.md -->
[link to template-2](./template-2.md), or [link to template-2](template-2.md)

Example 2 (template-3 is in inputdir/subdirectory/template-3.md):

<!-- content of inputdir/subdirectory/sub-subdirectory/template-1.md -->
[link to template-3](../template-3.md)

Describe alternatives you've considered

Currently, the only possible workaround is to use absolute paths (relative to the repository’s root, or to the input directory).

This is cumbersome for two reason (that I can think of):

  • if the absolute path is long, URLs can become very long and very verbose
  • this would break Obsidian links, if the main vault is a subdirectory of the main repository (see below)

Additional context

@zachleat
Copy link
Member

zachleat commented Sep 3, 2024

Shipping with 3.0.0-beta.2 and 3.0.0-alpha.19

@zachleat zachleat added feature: inputpath-to-url needs-documentation Documentation for this issue/feature is pending! labels Sep 20, 2024
zachleat added a commit to 11ty/11ty-website that referenced this issue Sep 27, 2024
@zachleat zachleat removed the needs-documentation Documentation for this issue/feature is pending! label Sep 27, 2024
@zachleat
Copy link
Member

Temporary docs preview url deploying here: https://11ty-website-git-v3-11ty.vercel.app/docs/plugins/inputpath-to-url/

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

No branches or pull requests

2 participants