Welcome to Shonku’s documentation!¶
Shonku is a static blog generator written in golang.
Contents:
History of the project¶
More than a year back I was introduced to Nikola, a static blog/site generator written in Python. It completely changed my view about blogs. Blogging suddenly became simple again and I started spending more time in writing than thinking about formatting etc.
But I was having problem in maintaining my theme and dependencies between upgrades also increased (which is a good thing in one way as the upstream is adding a lot of features in Nikola).
I started shonku from there with a hope to keep it as simplified Nikola written in golang. It works very fast too.
Installation¶
Install golang¶
Download golang from here , extract go directory under your home directory.
$ mkdir ~/gocode
Now write the following lines in your ~/.bashrc file.
export PATH=$PATH:~/go/bin
export GOPATH=~/gocode/
export GOROOT=~/go/
and then
$ source ~/.bashrc
Install the dependencies¶
After golang installation, get the dependent libraries.
$ go get github.com/russross/blackfriday
$ go get github.com/gorilla/feeds
$ go get code.google.com/p/go.net/html
Get the latest Shonku code¶
Use git to clone the repository
$ git clone https://github.com/kushaldas/shonku.git
Rebuilding bindata for default theme¶
In case you make any changes to the default theme, you want those changes inside the binary file also. For that issue the following command before building the binary.
$ go-bindata assets/... templates/
Note
Remember to install go-bindata from here.
Usage¶
Note
We support only Markdown format. You can learn it very fast and use any text editor to edit.
Creating new site¶
First go to an empty directory and run the following command.
$ ./shonku.bin -new_site
This will create the required files and directories for shonku to run.
Writing a new post¶
To write a new blog post do the following command.
$ ./shonku.bin -new
Enter the title of the post: Hello World
Your new post is ready at ./posts/hello-world.md
As the output shows your first blog post is ready. Make the changes as you want in that file.
Note
Remember to keep a blank line at the end of each post or page.
Building your post¶
Just run the following command.
$ ./shonku.bin
{SITE AUTHOR SITE TITLE http://localhost/ Copyright 2014 yourdisqus author@email Description of the site URL for logo [{/pages/about-me.html About} {/categories/ Categories} {/archive.html Archive}]}
Building post: ./posts/hello-world.md
You can check the output directory for the finished blog post.
Force rebuild of the whole site¶
$ ./shonku.bin -force
The above command will rebuild the whole site. You may want to use this command when you make any change to your theme or configuration file.
Details of each post¶
When you create a new post it will contain something similar to the details below
<!--
.. title: Hello World
.. slug: hello-world
.. date: 2014-05-19T12:15:41+05:30
.. tags: Blog
.. link:
.. description:
.. type: text
-->
Write your post here.
You can add more tags to the post, they are comma separated. This post format is same of Nikola v7.x, that means it is interchangable between these two blog engines.
Individual author per post¶
We can have individual author for each post. Just add the following line in any of the post where you want a different author (do it in the comments as show in above).
.. author: AUTHOR NAME
Configuration¶
Shonku works based on a JSON configuration file based on the primary directory. It is conf.json. Various values of the file is explained below.
- “Author” - is the site author’s name.
- “Title” - is the title of the blog.
- “URL” - is the url of the blog. Remember to give the trailing slash in the url.
- “Description” - long description of the site.
- “Logo” - Url of the logo for the blog.
- “Content_footer” - footer text
- “Email” - Author’s email.
- “Disqus” - your disqus name for dynamic comments.
- “Links” - For the links in the header of each page.
- “WithAMP” - If you have true for this, then it will try to build AMP post pages (you need output/posts/amp directory
for this to work.
Contributors¶
Names are not in any particular order.
- Bibhas : Wrote the patch for the slug creation.
- Siddhesh : Contributor to many different parts of the codebase.
Theming¶
We have a very simple theme in Shonku and one can easily modify the theme.
The primary directory to keep in mind is templates. This is where all template files are. If you make any changes to the templates remember to do a force build of the site.
All static files required for the current theme are located in the assests directory. You can add any static file there.