question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Attached image and alternatives

See original GitHub issue

I 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:closed
  • Created 7 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
relikdcommented, Nov 23, 2019

Can’t we simply put all attachments in a alternative-independent location? Then all alternatives can link to the same target.

my_page
  contents.lr
  contents+es.lr
  my_image.png

will build into:

en/my_page/index.html
es/my_page/index.html
attachements/my_page/my_image.png

with ![Alt text](../../attachements/my_page/my_image.png)

2reactions
bitwavecommented, Oct 23, 2017

👍 I have the same problem with attachments…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Write good Alt Text to describe images | Digital Accessibility​
The most appropriate alternative text for an image depends very much on the context of the image in question. You must provide information...
Read more >
Images Tutorial | Web Accessibility Initiative (WAI) - W3C
Images must have text alternatives that describe the information or function represented by them. This ensures that images can be used by people...
Read more >
Accessibility: Image Alt text best practices - Siteimprove Support
Images alternatives add valuable information for low vision or blind screen reader users. Image alternatives also benefit people who have ...
Read more >
Alternative Text - WebAIM
Alternative text is a textual substitute for non-text content in web pages. This article is focused on images, but its principles also apply ......
Read more >
Linked image missing alternative text - example
In this common example there is a group of cards as list items with white backgrounds, each containing a linked image and linked...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found