brianzelip


inputPathToUrl plugin doesn't respect relative paths for links in non-top level templates

Operating system

macOS Monterey v12.7.3

Eleventy

3.0.0-alpha.10

Describe the bug

The plugin requires that links to sibling pages on pages in sub directories be prefaced with the directory chain leading to their sub directory instead of the conventional ./

Reproduction steps

  1. 11ty v3.0.0-alpha-10 configured with eleventyConfig.addPlugin(InputPathToUrlTransformPlugin);
  2. An input directory with at least two files at the root where at least one of the pages links to the other, and a sub directory containing at least two files where at least one of the files links to the other, eg:
.
├── page1.md
├── index.md
└── about
    ├── page2.md
    └── index.md
  1. Links to sibling pages, eg:
# index.md

[Page1](./page1.md)
# about/index.md

[Page2](./page2.md)

Expected behavior

The href value on /index.html is as expected, /page1/

Expected href value on /about/index.html

/about/page2/

Actual href value on /about/index.html

./page2.md

Reproduction URL

demo

https://11ty-inputpathtourl-demo.pages.dev

code

https://github.com/brianzelip/11ty-inputPathToUrl-demo

Screenshots

Note that the demo on Cloudflare Pages behaves differently than in local dev mode.

Here is the /about/page2 on Cloudflare showing the top-level index.md in place of the nested /about/index.md (note the URL in the address bar):

cloudflare

Here is local dev:

local-dev

In both cases the href value is the same.