Using hugo

TurnToJPG -->

For switching my blogging engine from octopress to hugo, following are the steps.

Installing GO

ArchLinux installation is:

$ sudo pacman -S go
$ mkdir -p ~/go/{bin,src}
$ export GOPATH=~/go
$ export PATH="$PATH:$GOPATH/bin"

Get Hugo

Hugo could be fetched directly from github, install it via:

$ Notice you have to use redsocks!
$ go get -u -v
$ which hugo

First Blog

Create a new site:

$ hugo new site myblog
$ tree myblog
|-- archetypes
|-- config.toml
|-- content
|-- data
|-- layouts
|-- static
`-- themes

6 directories, 1 file

Creat a new blog:

$ hugo new post/
$ vim /home/vagrant/Code/myblog/content/post/
$ cd themes/
    git clone

Run preview of the blog:

$ hugo server -w --theme=hugo_theme_beg

Now open browser for visiting `http://localhost:1313", you could see:


Import From Octopress

Import from existing Octopress via:

$ hugo import jekyll /home/dash/Code/NewBlog/source hugodash
Congratulations! 720 post(s) imported!

A little tricky for changing the categories definitions:

$ cd hugodash/content/post
$ vim
$ chmod 777
$ ./

The content of the is listed as following:

for i in `ls ./*.markdown`
	# Generate the modified result, like categories: "a", "b", "c"
	replaceline=`grep -i "categories:" $i|awk
	sed -i "2s|.*|$replaceline|" $i

Then run following command:

$ sed -i '2s/\(:[[:blank:]]*\)\(.*\)/\1[\2]/' *.markdown

Now check your categories:

$ grep -i "categories:" ./ -r
./2015-03-12-maas-deploy-3.markdown:categories: ["Virtualization"]
./2016-03-31-nodemcu-and-1602i2c.markdown:categories: ["embedded"]

With this format could our markdown files be analyzied via new theme.

$ cd hugodash/themes
$ git clone

Preview the generated website via:

$ cd hugodash
$ hugo server --theme=hyde-x

Now open your browser and view http://localhost:1313.


Some work tips:

Remove all of the fucking codeblock in markdown:

$ sed -i -- 's|{% endcodeblock%}|\`\`\`|' *.markdown
$ sed -i -- 's|{% codeblock *.*%}|\`\`\`|' *.markdown

Remove all of the fucking backtick with language extended in markdown:

$ sed -i -r -e 's|^\`\`\`.*|\`\`\`|' *.markdown

Now all of the syntax hightlight is OK.