可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I'm looking for any solid current information on creating custom share icons for the following.
- Facebook
- Twitter
- Google +
- LinkedIn
- Pinterest
All the documentation I keep getting to seems to be about using THEIR social like / share buttons - which most of the time I think are not very appealing. Things like socialite.js help to deal with some of the other issues that arrise when using the "native" like / share buttons (sorry not sure what else to call them), but they're not very pretty to be honest.
Any reference material / tutorials or guidance would be awesome.
Cheers.
回答1:
Below, I am going to offer you the various services URL’s
Twitter
http://twitter.com/home?status=[TITLE]+[URL]
Digg
http://www.digg.com/submit?phase=2&url=[URL]&title=[TITLE]
Facebook
http://www.facebook.com/share.php?u=[URL]&title=[TITLE]
StumbleUpon
http://www.stumbleupon.com/submit?url=[URL]&title=[TITLE]
Delicious
http://del.icio.us/post?url=[URL]&title=[TITLE]]¬es=[DESCRIPTION]
Linkedin
http://www.linkedin.com/shareArticle?mini=true&url=[URL]&title=[TITLE]&source=[SOURCE/DOMAIN]
Slashdot
http://slashdot.org/bookmark.pl?url=[URL]&title=[TITLE]
Technorati
http://technorati.com/faves?add=[URL]&title=[TITLE]
Tumblr
http://www.tumblr.com/share?v=3&u=[URL]&t=[TITLE]
Reddit
http://www.reddit.com/submit?url=[URL]&title=[TITLE]
Google Bookmarks
http://www.google.com/bookmarks/mark?op=edit&bkmk=[URL]&title=[title]&annotation=[DESCRIPTION]
Newsvine
http://www.newsvine.com/_tools/seed&save?u=[URL]&h=[TITLE]
Ping.fm
http://ping.fm/ref/?link=[URL]&title=[TITLE]&body=[DESCRIPTION]
Evernote
http://www.evernote.com/clip.action?url=[URL]&title=[TITLE]
Google+
https://plus.google.com/share?url=[URL]
回答2:
Just a quick update on these links, here's a link for Google+
https://plus.google.com/share?url=[URL]
Now, if you want those links to open in a new window, just add this javascript code after the href's:
onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;"
This javascript code works with Twitter, Google+ and Facebook (maybe some other, but I haven't tested any other social networks).
Example for WordPress:
<a href="https://plus.google.com/share?url=<?php the_permalink(); ?>" onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">Here you can add text, image, whatever.</a>
回答3:
The solution suggested by Grzegorz is deprecated and it's not really the best way to do it. For Facebook, you just need to load the JS SDK ( https://developers.facebook.com/docs/reference/javascript/ ) and call the UI feed method on click on your custom button. More details on the UI method: https://developers.facebook.com/docs/reference/javascript/FB.ui/
For Twitter: https://dev.twitter.com/docs/tweet-button#build-your-own
You will have other options for LinkedIn, Google+, etc. but I don't know them from the top of my head and not sure if of all them offer alternatives.
Keep searching, you probably just didn't dig deep enough, it took me 2 minutes to find the link for Twitter :)
回答4:
Your required social media custom share links are provided below.
Facebook
http://www.facebook.com/sharer.php?u=[EncodedURL]
Twitter
http://twitter.com/share?text=[TITLE]&url=[URL]
Google +
https://plus.google.com/share?url=[EncodedURL]
LinkedIn
http://www.linkedin.com/shareArticle?mini=true&url=[EncodedURL]
Pinterest
http://pinterest.com/pin/create/button/?url=[EncodedURL]&media={[MEDIA]}&description=[TITLE]
You can find some other social media custom URL links and implementation guide from here - How to Create Custom Social Share Links
回答5:
For Facebook sharing you can simply add this link to any object:
<a href="http://www.facebook.com/sharer.php?u=<url to share>
&t=<title of content>">link or image</a>
For the rest: Sorry, but I cannot help you.
回答6:
In order to customize buttons as well as the share counts from different social networks and url sharing services, you can use a proxy server. The social button server Meddelare does exactly this (FYI, I'm the developer behind Meddelare).
Meddelare: This is an open source and self-hosted alternative to sharing services such as AddThis and ShareThis. Because you run the proxy server yourself, you are also defending your users’ privacy against the social networks’ tracking. Users only opt in to their tracking once they decide to click a share button – never implicitly just because they visited your page.
There are several versions: a standalone server, middleware for your Express.js server and a separate backend for completely custom solutions.
See Meddelare's examples for the JSON/JSONP you get from the server plus script usage.
回答7:
This is my solution for facebook in php. Guess you can do simular for other social networks.
function customFShare() {
$like_results = @file_get_contents('http://graph.facebook.com/'. get_permalink());
$like_array = json_decode($like_results, true);
return (isset($like_array['shares']) ) ? $like_array['shares'] : "0";
}
function fShareButton() {
return "<a data-share='http://www.facebook.com/sharer/sharer.php?u=". $your_url_here ."' href='#' rel='nofollow'><i>Icon</i> <span>". customFShare() ."</span></a>";
}
HTML
<div class="facebook-share">
<?php echo fShareButton(); ?>
</div>
JQuery
jQuery(document).on("click",".facebook-share > a", function (e) {
e.preventDefault();
var winHeight = 350,
winWidth = 520,
winTop = (screen.height / 2) - (winHeight / 2),
winLeft = (screen.width / 2) - (winWidth / 2),
link = $(this).data('share');
window.open(link, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight);
});
You will get nice facebook button with icon and counter.
回答8:
Twitter link format http://twitter.com/home?status=[TITLE]+[URL] is deprecated and will no longer work for the Twitter iOS app.
Use instead
https://twitter.com/intent/tweet?text=[TITLE]+[URL]
Source:
https://dev.twitter.com/web/tweet-button
回答9:
None of the answers here seem to actually answer the OP question. So here is my attempt:
Many social networks actually provide guidelines on how to use their logos, sharing icons and other links. Some are more flexible than others on that subject.
Of course, in most cases, they won't fit your design really well and you might want to customize them with your own theme/website colors.
"Do this at your own risks" is probably the best answer you will ever get.
I am not a lawyer (so this is no legal advice!) but from what I could read in different articles, some websites that were selling icon sets with customized social network logos were asked to remove them from their products list.
There is little chance that Facebook, Twitter or any other social network company will sue you (although they probably could) for having customized their icons/logos for your personal blog or website, but if you want to cover yourself, you probably want to consider following their guidelines...
Here are a few links to social network brands guidelines:
- Facebook: https://www.facebookbrand.com/
- Twitter: https://about.twitter.com/company/brand-assets
- Google+: https://developers.google.com/+/branding-guidelines
- StumbleUpon: http://www.stumbleupon.com/press/stumbleupon-image-use-guidelines
- Delicious: http://delicious.com/branding
- LinkedIn: https://brand.linkedin.com/
- Tumblr: https://www.tumblr.com/logo
- Reddit: https://www.reddit.com/about/alien/
- etc.
You can search the web for "[brandname] brand guidelines" to find these guidelines for almost every social network.
Some source for the above information if you want to read more:
- http://www.evolvecreativegroup.com/the-secretly-strict-brand-guidelines-of-social-media/
- https://www.quora.com/Internet-Law-Is-it-legal-to-alter-Facebook-and-Twitter-icons-to-match-the-rest-of-your-website
- https://webmasters.stackexchange.com/questions/54499/putting-altered-social-media-logo-icons-on-my-website-can-i-get-sued
- http://www.kgshultz.com/using-modified-social-media-icons/
- https://www.nosegraze.com/allowed-use-modified-social-media-icons/
Hope this helps.
回答10:
A github repo that is regularly updated and retested, with what looks like about ~50 or 60 services listed.
https://github.com/bradvin/social-share-urls
This is much better than the accepted answer. NewsVine, Delicious, Slashdot, Ping.fm, etc., are all non-existent services today. Plus, some important ones are missing, Skype, etc..