• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Github API: Github comments in Jekyll - Tech Hangout #32 - 2013.12.11
 

Github API: Github comments in Jekyll - Tech Hangout #32 - 2013.12.11

on

  • 2,030 views

On December 11, in the format of Tech Hangout internal meetings, Valeriy Rozuvan showed us an example of a blog hosted on Github using a commenting system based on Github. Valeriy also explained how ...

On December 11, in the format of Tech Hangout internal meetings, Valeriy Rozuvan showed us an example of a blog hosted on Github using a commenting system based on Github. Valeriy also explained how to work with the Github API on Front-End.

*TECH HANGOUT COMMUNITY was found in 2012 by the developers for the developers for knowledge and experience sharing. Such meetings are the part of Innovecs Educational Project that actively develops sphere of internal trainings and knowledge exchange program among professionals. This Initiative was born within the walls of Innovecs and has proved to be extremely popular and high-demand. In a short period of time it gained its own Facebook group with more than 90 members, blog with more than 40 posts and constant quarterly external meeting of Tech hangout community with more than 80 participants. The concept of the event proposes a 30-minute report on the topic previously defined, and the discussion in a roundtable session format.

Join to discuss - https://www.facebook.com/groups/techhangout/

Statistics

Views

Total Views
2,030
Views on SlideShare
2,028
Embed Views
2

Actions

Likes
1
Downloads
1
Comments
0

2 Embeds 2

http://www.linkedin.com 1
http://blog.innovecs.com 1

Accessibility

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Github API: Github comments in Jekyll - Tech Hangout #32 - 2013.12.11 Github API: Github comments in Jekyll - Tech Hangout #32 - 2013.12.11 Presentation Transcript

    • GITHUB API: GITHUB COMMENTS IN JEKYLL Tech Hangout #32 by Valera Rozuvan 11 December 2013
    • Transform your plain text into static websites and blogs.
    • Why? Simple No more databases, comment moderation, or pesky updates. Blog-aware Permalinks, categories, pages, posts, and custom layouts. Static Markdown (or Textile), Liquid, HTML & CSS go in. Static sites come out. GitHub Pages You can easily deploy your site using GitHub for free. Custom domain too.
    • Dr. Jekyll & Mr. Hyde
    • Installing Ruby & RubyGems On Ubuntu 12.04 LTS this is very simple: $ sudo apt­get update $ sudo apt­get install curl $ curl ­L https://get.rvm.io | bash ­s stable $ source ~/.rvm/scripts/rvm $ rvm requirements $ rvm install ruby $ rvm use ruby –default $ rvm rubygems current
    • Installing Jekyll This is the easy part ;) $ gem install jekyll Setting up a new blog $ jekyll new myblog $ cd myblog $ jekyll serve
    • Hosting on GitHub Every GitHub repository can have a special branch called gh-pages. You can place in this branch any static files (HTML, CSS, JavaScript, images, text, etc.) and it will be served from a server. The access URL is: http://user.github.io/repository Do note that this is static hosting! No PHP, Python, etc. Also, there is a delay between the time you push to GitHub the gh-pages branch and the time it will become accessible via the access URL.
    • Deploying Jekyll to GitHub The sources of the Jekyll blog will be placed in the master branch of our repository. Since we can't directly make GitHub serve Jekyll sources, we will tell Jekyll to generate all static content beforehand. The static content will be placed in the gh-pages branch. To generate a Jekyll blog: $ jekyll build  > ­­source <source>  > ­­destination <destination>
    • Tip The best work-flow is to have two separate directories, each being a clone of the working GitHub repository. In one directory you have the master branch checked out, and in the other you have the gh-pages branch checked out. Then updating your blog is as simple as: ... edit <master_dir> content ... $ jekyll build ­s <master_dir> ­d <gh_pages_dir> $ cd <gh_pages_dir> $ git commit ­a ­m "Updated blog." $ git push origin gh­pages
    • Don't forget! 1. In _config.yml, set the baseurl option to /projectname – note the leading slash and the absence of a trailing slash. 2. When referencing JS or CSS files, do it like this: {{ site.baseurl }}/path/to/css.css – note the slash immediately following the variable (just before “path”). 3. When doing permalinks or internal links, do it like this: {{ site.baseurl }}{{ post.url }} – note that there is no slash between the two variables.
    • What about comments?
    • Can't we use GitHub to store comments? Yes. Yes, we can. Each blog post is basically a file in a commit. A commit can have messages attached to it. We can use the commit messaging system as a commenting system!
    • How do we access GitHub commit comments from our blog? GitHub API to the rescue!
    • The technical details 1. Register a new OAuth GitHub application: https://github.com/settings/applications/new 2. Use the following URLs to make AJAX requests regarding commits, and their comments: • • https://api.github.com/repos/{{user}}/ {{repository}}/commits?path=_posts%2F{{name of  blog post file}} https://api.github.com/repos/{{user}}/ {{repository}}/commits/{{commit hash}}/comments Unfortunately, this method lacks authentication. GitHub limits unauthenticated requests to something like 60 requests per hour.
    • An awesome developer known by the GitHub handle m2w developed just such a commenting system. You can check it out at: https://github.com/m2w/talaria
    • A bit of code & Demo
    • Useful links ● http://goo.gl/pBXFGD [how to install Ruby and RubyGem on Ubuntu 12.04 LTS] ● http://jekyllrb.com/docs/quickstart/ ● http://jekyllrb.com/docs/usage/ ● http://jekyllrb.com/docs/github-pages/ ● http://goo.gl/ffF9vC [creating GitHub pages manually] ● https://github.com/m2w/talaria ● http://blog.tibidat.com/talaria/ ● http://blog.tibidat.com/ ● https://github.com/settings/applications/new
    • Thanks! ValeraRozuvan valera­rozuvan http://valera.rozuvan.net