hugo a new blog

this post is something about blog migration from hexo to hugo, it the same thing, but you know, I’d like search new things all the time.

Usage of hugo

hugo is more complicated then hexo, I think, but it’s more flexable however. Here is the general step of using hugo: * start a site first * start a post * select a theme * generate public files * push it on github

Ok, I am going write down those step one by one. For start a site, you gonna install hugo first, if you are using mac, you can install by brew:

brew install hugo

Then you can use hugo commond start a site:

hugo new site ~/Documents/myblog

And then, you can start a post for test:

hugo new post/my-first-post-on-hugo.md

ok, then you have to clone a theme on github,

cd themes
git clone https://github.com/pdevty/material-design

then you just get a material-design theme in your themes folder.

cd ..
hugo server --theme=material-design buildDrafts

you can see your blog on browser on 127.0.0.1:1313, sample blog All right, you must remember this:

hugo --theme=material-design --baseUrl="http://yourpage.github.io/"

above commod is using generate static files of your site. then: UPDATE 2017-01-17 Follow git add . was wrong, this maybe cause your site has no css style! change it into git add -A, the difference is -A will add all file but add . won’t.

cd public
git init
git add .
git commit -a -m "init commit"
git remote add origin http://github.com/yourpage/yourpage.github.io.git
git push -u origin master

And of course you can see your blog on http://yourpage.github.io

Some Notes

  • You must set baseUrl in your config.atoml file If you don’t, you may not see your site properly, it maybe have no css style!

  • That’s All Enjoy your new hugo blog!

Lewis Jin avatar
About Lewis Jin
Lewis Jin is a intelligent scientist, maybe he loves make funny AI program.
comments powered by Disqus