Welcome to Geeklog, Anonymous Friday, November 29 2024 @ 07:53 pm EST

Geeklog Forums

Sharing Geeklog articles on Facebook


Status: offline

winnerdk

Forum User
Full Member
Registered: 04/24/05
Posts: 339
Location:Panama City, Republic of Panama
I'm getting requests from users of my website who want a button to quickly and easily share the articles I publish via Facebook.

I know, all you have to do is copy and paste the URL, but people are accustomed to looking for the "F" logo and just clicking that.

What's the easiest way to include something like this automatically in every article published. Is there a plugin out there already that I missed?

Thanks.

Don Winner
www.panama-guide.com
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
You can add code to the story template files to do this (I do not know the code off hand). I believe Ben has done this for the PurePro theme (or is that for Facebook Likes, I can't remember) which can be found at Geeklog.fr.

You can also try the Social Share plugin. I believe this is the latest version: 1053

Tom
One of the Geeklog Core Developers.
 Quote

ironmax

Anonymous
Okay, here we go. To get either the fb:like or fb:comments to work on geeklog with articles, please see my forum post at Spacequad Internet Services. If you have any questions, please let me know.

If you want to test it out before making the changes on your own site, see my test site at demo.spacequad.com

Michael
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
@ Michael
please see my forum post at Spacequad Internet Services

the page displays
You should not be here!
Restricted access to this forum only.


@ Don

This code adds Facebook, Twitter and Google+
Customise it and put it where you need it in the story template files

Text Formatted Code

        <div style="float:left;" id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) return;
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/fr_FR/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));</script>
        <div style="float:left;margin-right:10px;"><fb:like href="{article_url}" send="false" layout="button_count" width="90" show_faces="false"></fb:like></div>
        <div style="float:left;margin-right:-20px;"><a href="https://twitter.com/share" class="twitter-share-button" data-url="{article_url}" data-text="{story_title}" data-counturl="{article_url}" data-lang="en" data-size="small" data-count="hortizontal">Tweet</a>
        </div><script>!function(d,s,id) { var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)) { js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs); } }(document,"script","twitter-wjs");</script>
        <div style="float:left;" class="g-plusone" data-size="medium" data-href="{article_url}"></div>
        <div class="g-plus" data-action="share" data-annotation="bubble" data-href="{article_url}"></div>
        <div style="clear:both;"></div>


Add also in your header
Text Formatted Code
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>


Demo on any article on geeklog.fr

Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

ironmax

Anonymous
Quote by: ::Ben

@ Michael

please see my forum post at Spacequad Internet Services

the page displays
You should not be here!
Restricted access to this forum only.


Ben



Okay all fixed. It was a simple permission setting in the forum.

I did have a look at your code Ben, and I like it, except that I think it would be better if you were to put the first part of your code below in the header.thtml towards the top after the body tag for the simple reason in case you want to reuse the code someplace else.

Text Formatted Code

        <div style="float:left;" id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) return;
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/fr_FR/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));</script>
 


This also precludes that its not being loaded more than once, and the possibilities of it throwing an error someplace. I also did a W3C on your page, and found allot of validation errors with it. I think your in the right direction using the script tags to try to deal with the validations. Have a look at what I have, and see if that helps. If you need help, let me know.

Michael
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Thank you for the reminder Michael.

Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

ironmax

Anonymous
See amendments to previous code that was now updated and W3C validated at Spacequad - Facebook Comments & Follow Us link

Michael
 Quote

Status: offline

winnerdk

Forum User
Full Member
Registered: 04/24/05
Posts: 339
Location:Panama City, Republic of Panama
@Ben - Thanks for the code. I tried it, and the Facebook code was for French language speakers. Any chance you could throw up an English version?

@Tom - I installed the Social Share plugin which seems to be working fine, but it does not include Twitter, which to me is much more important than Google+

@Michael - I got confused with the code you were trying to suggest, between this Forum, your forum, and the several changes and updates. Meaning, I wasn't able to understand what you were suggesting. What should I put - where...

Thanks all. Still working on this issue. The Social Share seems to be working for now as an interim measure, but I would like to get something running that would include Twitter as well.

Don
www.panama-guide.com
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
Check with the author of the Social Share plugin ( [user:7245] ). I know he was working on a new version so maybe he has/will add Twitter.



Tom
One of the Geeklog Core Developers.
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Social share plugin do support twitter.

To change Facebook language setyour language on the line
Text Formatted Code
js.src = "//connect.facebook.net/fr_FR/all.js#xfbml=1";

where fr_FR is for french.

Facebook locales

Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: offline

winnerdk

Forum User
Full Member
Registered: 04/24/05
Posts: 339
Location:Panama City, Republic of Panama
OK, so should I use "en_EN" for English?

Just a guess...

Don
 Quote

Status: offline

winnerdk

Forum User
Full Member
Registered: 04/24/05
Posts: 339
Location:Panama City, Republic of Panama
@Ben - For some reason the Facebook button doesn't show up. It starts with the Twitter button. So, although unintended, right now I'm getting Facebook covered with the Social Share plugin, and Twitter with your code.

Take a look - www.panama-guide.com

So far I've only put the code in for the main stories, not featured or archive...

Don
 Quote

All times are EST. The time is now 07:53 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content