like button implementation of my blog
-
Setup Firebase
-
Bind your domain if necessary
-
Alter
public/javascript/widget.js
to change hosting domaingetServer() { return 'https://like.lhzhang.com' // change this url to your firebase app url }
-
Alter
functions/index.js
to config corsconst whitelist = [ 'http://lhzhang.com' ] // change this domain to your blog domain
-
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 = '' <!-- 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>
-
Deploy
$ firebase deploy