如何使用Font Awesome字体实现基本的共享社交按钮? [英] How do I implement basic share social buttons with Font Awesome fonts?

查看:72
本文介绍了如何使用Font Awesome字体实现基本的共享社交按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎是一个简单的问题,但是如何在Rails应用程序中使用Font Awesome实现基本的社交共享按钮.

This may seem like a simple question, but how do I implement basic social share buttons with Font Awesome in my Rails App.

我想在我的PostsController#Show上实现它们.

I want to implement them on my PostsController#Show.

我开始研究它,认为它就像添加一个link_to一样简单-但很快意识到它并不那么简单.

I began looking into it, thinking it was as simple as just adding a link_to - but quickly realized it isn't as simple as that.

对于Twitter,您希望帖子的标题和URL一起包含在推文的正文中.我想Facebook也很相似.

For Twitter, you will want the title of the post to be included in the body of the tweet along with the URL. I imagine Facebook is similar.

任何人的奖励积分,也可以为如何包括WhatsApp共享提供提示-为此: http://whatsapp -sharing.com/-在每个帖子上也是如此.

Bonus points for anyone that can also give a tip for how to include WhatsApp sharing - per this: http://whatsapp-sharing.com/ - on each post also.

推荐答案

我刚刚完成了

I had just finished up a small article on my site in response to your comment when i saw your reply.

使用以下HTML:

<!-- Twitter -->
<a href="http://twitter.com/home?status=SHAREMESSAGE" title="Share on Twitter" target="_blank" class="btn btn-twitter"><i class="fa fa-twitter"></i> Twitter</a>
 <!-- Facebook -->
<a href="https://www.facebook.com/sharer/sharer.php?u=SHAREMESSAGE" title="Share on Facebook" target="_blank" class="btn btn-facebook"><i class="fa fa-facebook"></i> Facebook</a>
<!-- Google+ -->
<a href="https://plus.google.com/share?url=SHAREMESSAGE" title="Share on Google+" target="_blank" class="btn btn-googleplus"><i class="fa fa-google-plus"></i> Google+</a>
<!-- StumbleUpon -->
<a href="http://www.stumbleupon.com/submit?url=SHAREMESSAGE" title="Share on StumbleUpon" target="_blank" data-placement="top" class="btn btn-stumbleupon"><i class="fa fa-stumbleupon"></i> Stumbleupon</a>
<!-- LinkedIn --> 
<a href="http://www.linkedin.com/shareArticle?mini=true&url=&title=&summary=SHAREMESSAGE" title="Share on LinkedIn" target="_blank" class="btn btn-linkedin"><i class="fa fa-linkedin"></i> LinkedIn</a>

用共享消息替换SHAREMESSAGE.对于WhatsApp和IOS,您可以使用以下方法:

Replace SHAREMESSAGE with your share message. For WhatsApp and IOS you can use this:

<a href="whatsapp://send?text=SHAREMESSAGE">Share on WhatsApp</a>

但是我在Stack Overflow上的其他地方读到,这在Android上不起作用.祝你好运!

However I've read elsewhere on Stack Overflow that this doesn't work on Android. Good luck!

这篇关于如何使用Font Awesome字体实现基本的共享社交按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆