在URL中嵌入ruby:Middleman Blog

时间:2013-12-31 23:36:21

标签: html ruby-on-rails ruby gem middleman

我在Middleman博客上遇到一些facebook分享链接有问题: -

我有:

<%= link_to current_article, article %>

=&GT; <a href="http://0.0.0.0:4567/link_of_article">Article Title</a>

我想: -

<a class ="btn btn-primary" href="http://www.facebook.com/sharer.php?u=http://0.0.0.0:4567/link_to_title&text=Title of the Article Here" target="_blank"><i class="fa fa-facebook">Facebook Share</i></a>

1 个答案:

答案 0 :(得分:0)

<%= link_to "http://www.facebook.com/sharer.php?u=" + article_url(article, :text => article.title), :class => "btn btn-primary" do %>
  <i class="fa fa-facebook">
    Facebook Share 
  </i>
<%end%>

我假设current_article_urlhttp://0.0.0.0:4567/link_to_title