Skip to content
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

Feature request: Support for additional attributes #22

Open
seanhakbb opened this issue Jun 27, 2024 · 2 comments
Open

Feature request: Support for additional attributes #22

seanhakbb opened this issue Jun 27, 2024 · 2 comments

Comments

@seanhakbb
Copy link

Hello and thanks for a great plugin!

It would be nice if it were possible to set our own attributes to the picture- and/or img-tag.
For example we have a case where an image would use micro format schema and having an "itemprop" on the img tag.

But also some more advanced scenarios where a data attribute was applied.

Have you looked in to custom taghelpers? They are pretty useful for these type of helpers, I really like https://github.com/Jeavon/Slimsy
and i think something similar would work nice with PictureRenderer and PictureRenderer.Optimizely.

@ErikHen
Copy link
Owner

ErikHen commented Jun 29, 2024

Thanks! I will look into this after my summer vacation.

@ErikHen
Copy link
Owner

ErikHen commented Jul 26, 2024

Hi @seanhakbb , take a look at v3.12. It's now possible to add any attribute to the img element.
Note that this version introduces the PictureAttributes object which is sent in as a parameter to Picture.Render. From now on you use the PictureAttributes object for several settings. Some settings have been moved from the PictureProfile to the PictureAttributes object.

I have not created a taghelper or HTML-helper, because this library is also used in Blazor applications. I recommend creating your own HTML helper as a wrapper around PictureRenderer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants