Skip to main content

How to Add Facebook Share or Like Button in Blogger Templates

Social media sites like Facebook & Twitter could be great source of quality traffic for any blog. You can also add a Facebook Share or Like button in each of your posts. This button will allow users to quickly share a post on Facebook.
Note: This tutorial is no longer working. Facebook has changed it's codes. Try it and if it doesn't work, please don't comment or email me as I don't know the solution yet. Thanks :)

Add Facebook Share/Like Button Below Post Title

To add Facebook Like button below post title, simply follow these steps:
  1. Back up your Blogger template.
  2. Open the Template section.
  3. Blogger Updated Dashboard
  4. Click the Edit HTML button.
  5. Blogger Edit HTML Button
  6. A new window will open. You'd have to click the Proceed button to start editing.
  7. Blogger Proceed Button
  8. Check Expand Widget Templates option. The page will automatically refresh.
  9. Find <head> in your template and replace it with the following code:
    <head>
    
    <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 = &quot;//connect.facebook.net/en_US/all.js#xfbml=1&quot;;
      fjs.parentNode.insertBefore(js, fjs);
    }(document, &#39;script&#39;, &#39;facebook-jssdk&#39;));</script>
  10. Now find the following code:
    <b:includable id='post' var='post'>
      <div class='post hentry' itemscope='itemscope' itemtype='http://schema.org/BlogPosting'>
        <a expr:name='data:post.id'/>
        <b:if cond='data:post.title'>
          <h3 class='post-title entry-title' itemprop='name'>
          <b:if cond='data:post.link'>
            <a expr:href='data:post.link'><data:post.title/></a>
          <b:else/>
            <b:if cond='data:post.url'>
              <b:if cond='data:blog.url != data:post.url'>
                <a expr:href='data:post.url'><data:post.title/></a>
              <b:else/>
                <data:post.title/>
              </b:if>
            <b:else/>
              <data:post.title/>
            </b:if>
          </b:if>
          </h3>
        </b:if>

    You might see multiple codes similar to the above code. However, make sure that the code you find has <b:includable id='post' var='post'> in it.

    Tip: Just search for <data:post.title/> and you'll find the above code lines.
  11. Place the following code right AFTER the code in previous step:
    <b:if cond='data:blog.pageType == &quot;item&quot;'>
    <div class='fb-like' data-send='false' data-show-faces='true' data-width='450'/>
    </b:if>

    The result should look something like this:
    <b:includable id='post' var='post'>
      <div class='post hentry' itemscope='itemscope' itemtype='http://schema.org/BlogPosting'>
        <a expr:name='data:post.id'/>
        <b:if cond='data:post.title'>
          <h3 class='post-title entry-title' itemprop='name'>
          <b:if cond='data:post.link'>
            <a expr:href='data:post.link'><data:post.title/></a>
          <b:else/>
            <b:if cond='data:post.url'>
              <b:if cond='data:blog.url != data:post.url'>
                <a expr:href='data:post.url'><data:post.title/></a>
              <b:else/>
                <data:post.title/>
              </b:if>
            <b:else/>
              <data:post.title/>
            </b:if>
          </b:if>
          </h3>
        </b:if>
    
    <b:if cond='data:blog.pageType == &quot;item&quot;'>
    <div class='fb-like' data-send='false' data-show-faces='true' data-width='450'/>
    </b:if>
  12. That's it. Save your template. Open a post on your blog and see the Facebook button in action.

Add Facebook Share Button Below Post Body

To place the Facebook share button under each post, you have to follow the first 3 steps given above. Then find the code given in step 4 above. Scroll down a bit and you'll see the following code:

    <div class='post-body entry-content' expr:id='&quot;post-body-&quot; + data:post.id' itemprop='articleBody'>
      <data:post.body/>
      <div style='clear: both;'/> <!-- clear for photos floats -->
    </div>

Warning! Do not use 'Ctrl + F' to find the above code. You have to find the code given in step 4 and then you can find the above code by scrolling down a bit.

After finding the above code, place the following code right AFTER it:

<b:if cond='data:blog.pageType == &quot;item&quot;'>
<div class='fb-like' data-send='false' data-show-faces='true' data-width='450'/>
</b:if>

The result would look something like this:
    <div class='post-body entry-content' expr:id='&quot;post-body-&quot; + data:post.id' itemprop='articleBody'>
      <data:post.body/>
      <div style='clear: both;'/> <!-- clear for photos floats -->
    </div>

<b:if cond='data:blog.pageType == &quot;item&quot;'>
<div class='fb-like' data-send='false' data-show-faces='true' data-width='450'/>
</b:if>

After that, save your template. Open a post page on your blog and see the Facebook button in action :)
Sumber : [http://www.betatemplates.com]

Comments

Popular posts from this blog

Navigate Interesting Bromo

Gunung Bromo adalah pemandangan tempat wisata utama di Jawa Timur yang dapat dilihat dari puncak Gunung Penanjakan yang memiliki ketinggian 2.774 meter di atas permukaan laut dan merupakan gunung tertinggi kisaran Tengger atas. Para pengunjung dapat melihat matahari terbit yang indah, laut pasir dan pemandangan Gunung Bromo. Gunung Bromo bisa diakses dari Malang dan Surabaya hanya hanya 95 km. Selain itu, kita dapat melihat keunikan tradisi masyarakat Tengger, yang memiliki pekerjaan bersama dalam budaya Tengger kegiatan ritual masih ada seperti Kasada, Karo, Unan-unan, Entas-entas, dan Purnama Tilem. Jika pengunjung pergi ke sana, mereka akan menemukan panorama spektakuler di sepanjang jalan mereka, dilengkapi dengan udara segar dan jalan berliku-liku hily. Its diakses dari Pasuruan melalui Wonokitri - Tosari Bromo telah dikenal oleh semua pengunjung dunia. Mereka datang ke Bromo untuk menyaksikan matahari terbit. Pengunjung juga dapat melihat ke bawah ke kawah yang penuh asap,...

Biografi Alda Risma

Alda Risma Latar belakang Nama lahir     Alda Risma Elfariani Lahir     23 November 1982 Indonesia Bogor, Indonesia Meninggal     12 Desember 2006 (umur 24) Indonesia Jakarta, Indonesia Jenis Musik     blues, jazz Pekerjaan     penyanyi, aktris Tahun aktif     1997-2006 Perusahaan rekaman     Blackboard Pasangan     Iwan Sastrawijaya (putus) Orang tua     A. Farid R. & Halimah Alda Risma Elfariani/Alda R. binti A. Farid R. (lahir di Bogor, Jawa Barat, 23 November 1982 – meninggal di Jakarta, 12 Desember 2006 pada umur 24 tahun) adalah penyanyi dan aktris Indonesia. Wanita bertinggi badan 160 cm ini populer terutama melalui lagu Aku Tak Biasa. Ia pernah pula berkolaborasi dengan boyband Code Red. Kehidupan awal Alda Risma lahir di Bogor pada tanggal 23 November 1982. Ibunya bernama Halimah. Ia dibesarkan di Cikaret, ...

suku tengger di Desa Wonokitri

Mengantar Roh Menghadap Hyang Widi Hong wilaheng mangkudaya jagad dewa bathara eyang jagad pramudita ingkang miwiti, ndugiaken kajate saking bapak Sudarmiko kang sedekah ngentas dateng siti dermaipun ……… . Itulah sepenggal bacaan mantra yang diucapkan sang dukun Suku Tengger, Supayadi, ketika acara hajatan entas-entas dari keluarga Sudarmiko alias Ikok, di Balai Desa Wonokitri, Kecamatan Tosari, Kabupaten Pasuruan. Ya, sang dukun antara lain bertugas sebagai pengantar upacara adat, termasuk entas-entas. Sebagai pengantar upacara adat, sang dukun tidak digaji, tetapi ia menerima dari masyarakat secara sukarela. Entas-entas adalah sebuah acara adat untuk mengentas leluhur yang sudah meninggal. Di acara tersebut rangkaiannya antara lain rakan tawang, mohon ijin kepada yang akan ditempati. Kedua, merniti (menghitung leluhur yang akan diswargakan atau yang akan dientas). Esok dilanjutkan ngelukat sebagai acara puncak atau pembersihan leluhur. Di tengah-tengah membacakan mantranya, ...