New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need additional attributes for picture tag #11793
Comments
Hello (again) @andre-fuchs Wagtail uses the The docs acknowledge using filenames as alt text by default is not really appropriate as it is not clearly communicated in the interface. The good news is that there are improvements on the horizon in the form of a Google Summer of Code project. If you are interested, here is a link to the discussion. To summarise;
Note: I couldn't find any mention of being able to override the alt text like this in the docs for the picture templatetag – I suppose it would make a good docs addition. |
Thanks, @Stormheg. It would make sense to allow custom attributes in this picture tag, like "class", "data", "zoom", too. To my limited knowledge of Django template tags this is not possible, right? And, yes, I used custom Image model before as a workaround. Good to know that the picture tag allows custom alt tag values. |
I'm not sure, just tried it on bakerydemo with Wagtail 6.0 and it appears to be possible to add extra attributes.
|
I love the
picture
template tag, which renders a picture element with multiple image format sources. This works perfectly fine and simplifies my template code for images significantly. The only feature missing here are additional attributes like aclass
name or a customalt
attribute, for example. For now the picture tag renders the img element with the file name as alt text, which is not satisfying. Or is this already possible but not documented yet?The text was updated successfully, but these errors were encountered: