eleventy-img
eleventy-img copied to clipboard
Transform plugin incompatible with permalink
Repro here: https://github.com/nathonius/11ty-demo/tree/main/4-images
Discord thread about this issue
When a urlPath
option is NOT provided to the transform plugin, but the template including the image has a permalink
attribute that is a filename, not a directory, the image source is incorrectly uses the full html path as if it was a directory. For example:
/blog/posts/Blog Post.md
---
permalink: blog/posts/blog-post.html
---

results in
<img src="/blog/posts/blog-post.html/BshP-bOYIK-710.jpeg" alt="alt text" width="710" height="618">
I'd expect it to understand that the permalink is the full path to the file in this case, not a directory with an index file. This should result in the following (which correctly links to the file):
<img src="/blog/posts/BshP-bOYIK-710.jpeg" alt="alt text" width="710" height="618">
Either removing the permalink (or using a directory permalink) or using a urlPath
in the plugin config bypasses the issue.