【问题标题】:how to use html_safe in meta tag og:description content in ruby on rails如何在 ruby​​ on rails 的元标记 og:description 内容中使用 html_safe
【发布时间】:2015-10-09 09:43:44
【问题描述】:

我像这样使用 og:description 元标记

<meta property="og:description" content="<%= @post.description.html_safe %>" />

但它会在页面顶部显示帖子的描述。

【问题讨论】:

标签: ruby-on-rails facebook-share html-safe


【解决方案1】:

我的 php 代码显示 og 文件时遇到过这个错误。我想,它会在 Rails 中工作。您只需将"" 更改为''

<meta property="og:description" content='<%= @post.description.html_safe %>'/>

<meta property="og:description" content='<%= @post.description %>'/>

希望对你有所帮助。

【讨论】:

  • 好的。很高兴能提供帮助。 :)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-07-02
  • 2014-05-13
  • 2012-07-28
  • 1970-01-01
  • 1970-01-01
  • 2020-09-07
相关资源
最近更新 更多