This might seem intimidating initially but after you’ve wrapped your head around it should be easy to understand.

_includes

You can place any .html files in here and then include them anywhere you want with the following tag:

{ % include FILE_NAME.html % }

This is especially helpful if you want to example use Disqus in your blog. I’ve included the javascript code in a disqus.html file and whenever I want to use it I can simply include it with the above tag.

_layouts

The files in here are going to be the basic building blocks of your site. At the top of this post:

layout: post

therefore i access the post.html file in _layouts. That post.html file is based of a default.html file. Therefore I don’t have to worry about any CSS or HTML after the site has been set up once.

_posts

All your posts go in here. Look at the end of this post to see how I have written this post.

#!/usr/bin/env ruby# *********************************************# Jekyll Post Generator Awesomeness# by Cody Krieger (http://codykrieger.com)# *********************************************# Usage:# % ./newpost.rb POST NAMEifARGV.empty?orARGV[0].downcase=="--help"orARGV[0].downcase=="-h"puts<<-USAGE Usage: % ./newpost.rb POST NAME USAGEexit(ARGV.empty??1:0)endclassString# from ruby on rails (https://github.com/rails/rails)# activesupport/lib/active_support/inflector/transliterate.rbdefparameterize(sep='-')# replace accented chars with their ascii equivalentsparameterized_string=self.dup# Turn unwanted chars into the separatorparameterized_string.gsub!(/[^a-z0-9\-_]+/i,sep)unlesssep.nil?||sep.empty?re_sep=Regexp.escape(sep)# No more than one of the separator in a row.parameterized_string.gsub!(/#{re_sep}{2,}/,sep)# Remove leading/trailing separator.parameterized_string.gsub!(/^#{re_sep}|#{re_sep}$/i,'')endparameterized_string.downcaseendendTEMPLATE="template.markdown"POSTS_DIR="_posts"# Get the title and use it to derive the new filenametitle=ARGV.join(" ")filename="#{Time.now.strftime('%Y-%m-%d')}-#{title.parameterize}.markdown"filepath=File.join(POSTS_DIR,filename)# Load in the template and set the titlepost_text=File.read(TEMPLATE)post_text.gsub!('%%TITLE%%',title)# Write out the postpost_file=File.open(filepath,'w')post_file.putspost_textpost_file.closeputs"Successfully created file => #{filepath}"

Execution:

./newpost.rb Test Post

chmod u+x newpost.rb might be needed in order for the script to be executable.

The script is going to look for a file named template.markdown in you Jekyll root directory. This template is a basic Jekyll post that you have to fill in with your content.

or you can do some in-line implementations for example here : \( P(E) = {n \choose k} p^k (1-p)^{ n-k } \) or if you have a long paragraph in another line \( 0_{2} - 1_{2} \) so you can make your posts - whatever they might be about - look really fancy and nice.

Using Latex like this takes a little more than just writing down normal latex code but I am going to cover that in another post. But basically I am just using the MathJax library with some configuration changes.