kpumuk / meta-tags

Search Engine Optimization (SEO) for Ruby on Rails applications.
MIT License
2.73k stars 275 forks source link

supporting og:image source AND width, height, and type #65

Closed leereilly closed 9 years ago

leereilly commented 10 years ago

Hi there,

I :heart: your gem!

I'm running into trouble trying to specify and image source and the additional (albeit optional) width, height and type properties e.g. from Facebook's Example:

I'm trying to recreate this:

<meta property="og:image" content="http://example.com/lamb-full.jpg">
<meta property="og:image:type" content="image/jpeg">
<meta property="og:image:width" content="3523">
<meta property="og:image:height" content="2372">

Following your spec, I create this (you can see where it will fail):

set_meta_tags :og => {
  :image    => "http://example.com/lamb-full.jpg",
  :image    => {
    :type  => "'image/jpeg"
    :width  => "3523",
    :height => "2372"
  }
}

... and I get this when I call display_meta_tags (the URL is missing)

<meta property="og:image:type" content="image/jpeg">
<meta property="og:image:width" content="3523">
<meta property="og:image:height" content="2372">

The reason why is obvious. Just wondering if you had any workarounds?

Cheers, Lee :beers:

zrisher commented 10 years ago

Fixing #63 would fix this as well.

naveda89 commented 9 years ago

This maybe fixed on #68.

AlecRust commented 9 years ago

Would be great to get this fixed :+1:

flaviomestre commented 9 years ago

Looking forward to this fix too! thanks

kpumuk commented 9 years ago

See c92294fa9a91a0c08720cb323a9d9bf55810e1e8 for example, this is already supported

kpumuk commented 9 years ago

Not exactly. Two hours ago documentation and a spec was added (pull request merged)

zfhui commented 8 years ago

We bypassed this problem like this:

set_meta_tags og: {
  'image': "http://example.com/lamb-full.jpg",
  image: {
     type: 'image/jpeg', 
     width: '3523',
     height: '2372'
  }
}