gfscott / eleventy-plugin-embed-everything

An Eleventy plugin to easily embed common media formats in posts, using only their URLs
https://gfscott.com/embed-everything/
MIT License
99 stars 6 forks source link

Add custom title text for the iframe #205

Closed colinaut closed 8 months ago

colinaut commented 12 months ago

This is an enhancement request to add the ability to have custom title text on the iframe. Accessibly requirements at my institution encourage adding a title attribute on any iframe for screen readers (see SiteImprove's Guidelines). Not sure how you'd implement it with this plugin but it would be great if possible.

As I assume you know, the normal markdown for an image allows titles for images as such:

![alt text](image url "image Title")

So maybe it could detect a single line with the title quoted after?

https://www.youtube.com/watch?v=TXh1zfd21T8 "iframe title"

Anyways, thanks for this plugin as it's been a great help! If you had the ability to add this it would be really useful.

gfscott commented 12 months ago

Cool! Yeah, I think this is doable and the accessibility improvement is definitely worthwhile.

I'll look into it a little more but I think my preferred way to handle this is to add a configurable option to download the video title via oEmbed (example data).

Just thinking out loud here:

Pros:

Cons:

On balance, I think making it opt-in globally is the right tradeoff. Interested if anyone has other perspectives to add!

colinaut commented 12 months ago

Yeah if it downloaded the video title that would be ideal!! I agree opt-in sounds like the best too.

gfscott commented 9 months ago

Re-opening this issue because adding this feature with v1.18.0 also introduced a bug that caused duplicate embeds — I suspect related to switching to async replace. I "fixed" this with 1.18.1 by simply removing the feature in #231. Annoying, sorry! Hoping to add it back in soon.