Monday, September 29, 2014

Quickly Deploy Your Own Blog At Home or Office | Using Hugo

Hugo is a fast and powerful blog engine, and is itself a web server:
- easy to use
- easy to deploy
- NO apache webserver needed
- has themes to choose from
- use Markdown to easily write content
- ... etc....

Step 1)  Download Hugo https://github.com/spf13/hugo/releases
- Or you can build from source using the "go language"


Step 2) run "hugo.exe new site /path/to/site"

- it will create the hugo folder structure
- to run hugo.exe, open the "cmd.exe" from the run prompt
- the run prompt is opened using the "windows key + r"


Step 2.1) [Optional]  create a new content.
2.1.1) change directory to the base directory of your blog, "cd /path/to/site"
2.1.2) execute "hugo.exe new my-new-content.md"
- A new text file is created under the "content/" folder.
-  Your hugo content will ends with ".md", it means that you will be writing blogs in Markdown format.
- I am using "LiteIDE" to edit my markdown,


Step 3) Start blogging, adding "markdown" texts content after the "+++"

Step 4) download themes (https://github.com/spf13/hugothemes)
- click a theme, then find the "Download Zip" button from the bottom-right.
- only click the "download zip" button once you are inside a theme.

Step 5) Create a "themes folder"
- "/path/to/site/themes"
the folder structure will look like:

\---test
    +---archetypes
    +---content
    +---layouts
    +---public
    +---static
    \---themes
        \---hyde

I downloaded the theme "hyde" and paste it in the themes folder:

\---themes
    +---hyde
    |   +---archetypes
    |   +---layouts
    |   |   +---chrome
    |   |   \---_default
    |   \---static
    |       \---css

Step 6) Modify "config.toml"
baseurl = "http://localhost:8080"
languageCode = "en-us"
title = "my new hugo site"

Step 7) Run your web server!
cd /path/to/site
> hugo.exe server --port=8080 --buildDrafts --theme=hyde

Step 8) Using a webbrowser browse to "http://localhost:8080"
- your blog is located at "http://localhost:8080/my-new-content/"


Step 9) To view your blog from a different computer you need to know your hostname or IP address first.
- run cmd.exe, type "hostname" then enter
- or type "ipconfig" for the IP address
- then from a computer connected to yours, browse to "http://the-hostname/"

Happy blogging!