Tuesday, December 8, 2009

Using Jekyll - blog post for static website

Basically jekyll is the gem which is mainly used for blog aware and static web page generator.
Jekyll follows its own directory structure and we can write it in any markup languages such as HTML, Textile or markdown etc.

#Install Jekyll gem

$ sudo gem install jekyll

You should have your website directory like

|--_layout/
|----default.html
|--_post/
|----2009-12-8-how-to-post-a-blog-using-jekyll.html
|--css/
|----style.css
|--js/
|--index.html
|--_config.yml

The configuration for jekyll as follows

#_config.yml

destination: ./_site
auto: false # for auto updation without restarting jekyll server
lsi: true
server_port: 4000 #port number for server
permalink: date #Type of url generated for _posts


The _layout/ folder contains the default layout for website and you can have multiple layouts

The _post/ folder contains the blog post for your website Blog.

The post file name should be in this format "2009-12-8-how-to-post-a-blog-using-jekyll.html"
For reference

In terminal

cd website/ #give project directory
jekyll #It creates the _site/ in your website folder

The _site/ folder has the static web pages with blog posts...

For example:

Layout page i.e default.html has html, head and body tags

default.html:

Inside Body tag contains
{{ content }}

This will replace the content for each page..

The Index.html looks like

index.html

---
layout: default
title: Index Page
---

<------ content for index page ---------->


After runninng the jekyll all this convention are converted as static page.

No comments:

Post a Comment