Version
2.4.3
Platform
Linux (WSL), should also reproduce on other platforms
What steps will reproduce the bug?
In a directory with two files:
-
_config.ts:
import lume from "lume/mod.ts";
import relativeUrls from "lume/plugins/relative_urls.ts";
const site = lume();
site.use(relativeUrls());
export default site;
-
test.md:
---
url: /a.html
---
[Go to index](/)
Run lume.
How often does it reproduce? Is there a required condition?
Always reproducible.
What is the expected behavior?
The URL / should be translated to ., so that the link leads to index.html.
What do you see instead?
In _site/a.html, the URL / is translated to an empty string. The link leads to a.html itself.
<!DOCTYPE html>
<html><head></head><body><p><a href="">Go to index</a></p>
</body></html>
Additional information
There are many other cases where the plugin fails; the above is just an example.
It is problematic even if url is not set explicitly: Trailing slashes in URLs are removed, but prettyUrls (on by default) requires them. While Lume dev server handles missing trailing slashes by redirection, not all static hosting providers do.
The plugin uses jsr:@std/path/posix, a module intended for POSIX filesystems. In POSIX path operations, trailing slashes are ignored. But in URLs, they are significant.
Version
2.4.3
Platform
Linux (WSL), should also reproduce on other platforms
What steps will reproduce the bug?
In a directory with two files:
_config.ts:test.md:Run
lume.How often does it reproduce? Is there a required condition?
Always reproducible.
What is the expected behavior?
The URL
/should be translated to., so that the link leads toindex.html.What do you see instead?
In
_site/a.html, the URL/is translated to an empty string. The link leads toa.htmlitself.Additional information
There are many other cases where the plugin fails; the above is just an example.
It is problematic even if
urlis not set explicitly: Trailing slashes in URLs are removed, butprettyUrls(on by default) requires them. While Lume dev server handles missing trailing slashes by redirection, not all static hosting providers do.The plugin uses
jsr:@std/path/posix, a module intended for POSIX filesystems. In POSIX path operations, trailing slashes are ignored. But in URLs, they are significant.