Closed zrisher closed 9 years ago
Instead of use an option like [:og][:images]
I would suggest to keep the option as [:og][:image]
and let pass an attribute as an array of string (with URLs) or an array of hash with the desired structure.
I'm gonna take a look :smile:
@naveda89 Supporting both :image
and :images
would make the most sense for the general Ruby user, whereas :image
makes sense for someone who knows that the OG property value will simply be og:image
repeated multiple times. Similarly, using :_
for the image URL is probably confusing for someone who doesn't know that og:image:url
and og:image
are equivalent properties.
Since this gem creates an interface, I'd personally opt to abstract away the actual OG property values. But I understand that staying closer to them simplifies implementation quite a bit, so I won't complain. : ) Thanks for the PR.
This is already supported, see https://github.com/kpumuk/meta-tags/commit/c92294fa9a91a0c08720cb323a9d9bf55810e1e8 for example
Open graph supports "structured properties" for images, videos, audio, etc.
Currently, this gem allows us to set them for a video through the
[:og][:video]
hash. But[:og][:image]
takes a string or an array for the image urls, from which we get one or severalog:image
tags.It would be great to have an option
[:og][:images]
that takes an array of hashes, where each hash can specify the:url
,:width
,:height
,:type
, and:secure_url
for the image. (Note the<meta name="og:image:url" ...>
tag is equivalent toog:image
.)Specifying the width, height, and type is a convenience for people who are having trouble getting FB/Linkedin/etc to properly analyze their image. But being able to pass the secure_url is essential for sites whose image canonical protocol is https. And as we've seen just this month, Google is giving you points for moving towards the future of the web by using HTTPS.
While working on this, it would probably be good to look towards similar options for other Open Graph objects that can be listed multiple times and have individual properties.