Skip to content

waynezhang/blog-like-btn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blog-like-btn

like button implementation of my blog

Setup

  1. Setup Firebase

  2. Bind your domain if necessary

  3. Alter public/javascript/widget.js to change hosting domain

    getServer() {
      return 'https://like.lhzhang.com' // change this url to your firebase app url
    }
  4. Alter functions/index.js to config cors

    const whitelist = [ 'http://lhzhang.com' ] // change this domain to your blog domain
  5. Add scripts to your blog post

    <span
        class           = "like-wrapper"
        like-shortname  = '{{ site.disqus }}'  <!-- required. any string works -->
        like-identifier = '{{ page.guid }}'  <!-- identifier of this post, uuid prefered -->
        like-name       = '{{ page.title }}'  <!-- post title -->
        like-btn        = '&#xf087;'  <!-- text for like button -->
        like-link       = '{{ site.atom-baseurl }}{{ page.url }}'  <!-- post link -->
    >
    </span>
    <script type="text/javascript">
      var l = document.createElement('script');
      l.type = 'text/javascript'; l.async = true; l.src = 'http://like.lhzhang.com/javascript/widget.js';  // change this url to your firebase hosting url of widget.js
      (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(l);
    </script>
  6. Deploy

    $ firebase deploy

About

like button implementation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published