Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add social shares (dependent on data.yml) #7

Open
coolaj86 opened this issue Jul 12, 2013 · 0 comments
Open

Add social shares (dependent on data.yml) #7

coolaj86 opened this issue Jul 12, 2013 · 0 comments

Comments

@coolaj86
Copy link
Member

This is a blog right? Don't we want to share it with the world?

twitter/layouts/default.html

<body>
    <div id="fb-root"></div>
    {{# data.author.facebook }}
    <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/en_US/all.js#xfbml=1{{# data.author.facebookAppId}}&appId={{data.author.facebookAppId}}{{/ data.author.facebookAppId}}";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>
    {{/ data.author.facebook }}

    <!-- g+ -->
    {{# data.author.googleplus }}
    <!-- Place this tag after the last +1 button tag. -->
    <script type="text/javascript">
      (function() {
        var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
        po.src = 'https://apis.google.com/js/plusone.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
      })();
    </script>
    {{/ data.author.googleplus }}

    <!-- twitter -->
    {{# data.author.twitter }}
    <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="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
    {{/ data.author.twitter }}

twitter/layouts/post.html

      <!-- likes and shares -->
      <div class="css-end-shares">
        <!-- twitter -->
        {{# data.author.twitter }}
        <span class="css-tweet">
          <a href="https://twitter.com/share" class="twitter-share-button" data-via="_99bottlesofpop">Tweet</a>
        </span>
        {{/ data.author.twitter }}

        <!-- g+ -->
        {{# data.author.googleplus }}
        <span class="css-plusone">
          <!-- Place this tag where you want the +1 button to render. -->
          <div class="g-plusone" data-size="medium"></div>
        </span>
        {{/ data.author.googleplus }}

        <!-- facebook -->
        {{# data.author.facebook }}
        <span class="css-like">
          <div class="fb-like" data-href="http://99bottlesofpop.com{{ url }}"
            data-send="true" data-layout="button_count" data-width="450" data-show-faces="false"></div>
        </span>
        {{/ data.author.facebook }}

Note: Maybe it should have been data.widgets.facebook, etc. But whatever, some sort of author recognition.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant