html - 如何从社交媒体缩略图中排除 Jumbotron 图像?

标签 html ruby-on-rails ruby facebook thumbnails

每当我的博文被分享时,缩略图会自动优先显示超大屏幕图片,而不是默认为博文图片:

enter image description here

enter image description here

查看

<%= 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}) %>

最佳答案

尝试将此标记添加到 <head></head>

<meta property="og:image" content="<%= image_path('your_image') %>" />

排除图像被共享使用的可能解决方案是使用具有 CSS background-image 属性的 div。相反

<%= image_tag "galli-walking.jpg", alt: "Conquering life and goal challenges so we can get the most out of life.", class: "main-image" %>

使用

<div style="background-image: url('galli-walking.jpg'); width:Xpx; height:Xpx;></div>

关于html - 如何从社交媒体缩略图中排除 Jumbotron 图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38383950/

相关文章:

ruby-on-rails - 如何在后台添加视频以进行设备 Controller 注册?

javascript - 使用 JS 展开/折叠 div 常见问题解答

jquery - 使用jQuery随机设置图像背景

ruby-on-rails - Rack session key 对于 memcached 来说太长了

mysql - ThinkingSphinx::SphinxError(未知的 MySQL 错误)

ruby-on-rails - mongoid as_document 错误

ruby - 为什么 Ruby 在抛出 NameError 异常后仍保留代码求值?

javascript - 无法在 javascript 中将图像调整为 100%

javascript - 正则表达式替换 HTML 标签

ruby-on-rails - “sarlLegalStatuses”不是受支持的 Controller 名称