Whenever my blog post is shared, the thumbnail is automatically the jumbotron image first instead of defaulting to the blog post image:
view
<%= image_tag "galli-walking.jpg", alt: "Conquering life and goal challenges so we can get the most out of life.", class: "main-image" %>
<div class="blog-text">
<div class="blog-paragraph">
A DAILY BLOG ABOUT MY<br>
JOURNEY & LIFESTYLE
</div>
<%= render 'subscribes/subscribe.html.erb' %>
</div>
<%= link_to @post.title, blog_path(@post) %>
<%= simple_format(@post.body, {}, {:sanitize => false}) %>
Try to add this tag to <head></head>
<meta property="og:image" content="<%= image_path('your_image') %>" />
Possible solution to exclude image from using by share is to use div with CSS background-image property. Instead
<%= image_tag "galli-walking.jpg", alt: "Conquering life and goal challenges so we can get the most out of life.", class: "main-image" %>
use
<div style="background-image: url('galli-walking.jpg'); width:Xpx; height:Xpx;></div>
Read more from these articles. All you need is to dynamically generate Facebook Open Graph meta tag like so.
<meta property="og:image" content="http://static01.nyt.com/images/2015/02/19/arts/international/19iht-btnumbers19A/19iht-btnumbers19A-facebookJumbo-v2.jpg" />
https://blog.kissmetrics.com/open-graph-meta-tags/
https://developers.facebook.com/docs/sharing/webmasters
Generating Facebook Open Graph meta tags dynamically
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With