Question

I am having some problem with some facebook share link on Middleman blog:-

Well I have :

<%= link_to current_article, article %>

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

I am trying to have:-

<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>
Was it helpful?

Solution

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

I am assuming that current_article_url is http://0.0.0.0:4567/link_to_title

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top