Attached image and alternatives
See original GitHub issueI have a content directory with an image as attachment:
my_page
contents.lr
contents+es.lr
my_image.png
In both contents.lr and contents+es.lr, I embed the image using markup:
![Alt text](my_image.png)
This works in debug mode but not when building.
Generated html for contents.lr
and contents+es.lr
:
<img src="./my_page/my_image.png" alt="Alt text">
<img src="../es/my_page/my_image.png" alt="Alt text">
Since images are exported only the primary alternative directory, this fails.
AFAIU, if using the image in a template, the url
filter resolves the path correctly, but not when pointing to the image directly from the code, either using markup (or plain html).
Am I misusing Lektor? How are we supposed to use attachments with alternatives?
This is basically the same issue as https://github.com/lektor/lektor/issues/88, except my answer to @mitsuhiko’s question
Is this in combination with markdown?
would be yes. Although the same happens when using plain html rather than markup so a solution relying on the markup rendering to sort this out, assuming this is even feasible, wouldn’t be really satisfying, considering image markup is pretty basic and plain html is the only way around in many circumstances.
(Currently, our workaround is to duplicate the images in all alternatives manually after the build.)
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
Can’t we simply put all attachments in a alternative-independent location? Then all alternatives can link to the same target.
will build into:
with
![Alt text](../../attachements/my_page/my_image.png)
👍 I have the same problem with attachments…