hugo-the best static website builder

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Hugo is a static site builder implemented by the go language. Simple, easy to use, efficient, easy to scale, fast to deploy.

Quick Start

Install Hugo

1. Binary installation (recommended: simple, fast)

Hugo binaries to Hugo releases download the corresponding operating system version (Hugo or Hugo.exe)

Use the installation directly under Mac Homebrew :

brew install hugo

2. Source code Installation

The source code compiles the installation, first installs the dependent tool:

    • Git
    • Mercurial
    • Go 1.3+ (Go 1.4+ on Windows)

Set up GOPATH environment variables, get the source code and compile:

$ export GOPATH=$HOME/go$ go get -v github.com/spf13/hugo

The source code will be downloaded to the $GOPATH/src directory, binary in$GOPATH/bin/

If you need to update all Hugo's dependent libraries, add -u parameters:

$ go get -u -v github.com/spf13/hugo

Build site

Use Hugo to quickly generate a site, such as the path you want to generate /path/to/site :

$ hugo new site /path/to/site

This /path/to/site creates the initial site in the directory, in the directory:

$ cd /path/to/site

Site Directory structure:

  ▸ archetypes/  ▸ content/  ▸ layouts/  ▸ static/    config.toml

Create an article

To create a about page:

$ hugo new about.md

about.mdAutomatically generated to content/about.md , open to about.md look under:

+++date = "2015-10-25T08:36:54-07:00"draft = truetitle = "about"+++正文内容

The content is Markdown formatted, and +++ the content is in TOML format, depending on your preference, you can change to YAML format (using --- tags) or JSON format.

Create the first article, put it in the post table of contents, and then build the aggregated page.

$ hugo new post/first.md

Open Edit post/first.md :

---date: "2015-10-25T08:36:54-07:00"title: "first"---### Hello Hugo 1. aaa 1. bbb 1. ccc

Installing the Skin

To the skin list pick a favorite skin, such as you feel Hyde good skin, find the relevant GitHub address, create a directory themes , in the themes directory to put the skin git clone down:

# 创建 themes 目录$ cd themes$ git clone https://github.com/spf13/hyde.git

Run Hugo

Execute the command at your site root Hugo to debug:

$ hugo server --theme=hyde --buildDrafts --watch

Use --watch parameters to have the browser refresh automatically when you modify the content of the article.

Open in Browser:http://localhost:1313

Deployment

Suppose you need to deploy on GitHub Pages , first create a repository on GitHub, named: coderzh.github.io (Coderzh replaced by your GitHub username).

Execute commands at the site root to Hugo generate the final page:

$ hugo --theme=hyde --baseUrl="http://coderzh.github.io/"

If all goes well, all static pages are generated to the public directory, and all the files in the PUBILC directory push go to the branch of the repository you just created master .

$ cd public$ git init$ git remote add origin https://github.com/coderzh/coderzh.github.io.git$ git add -A$ git commit -m "first commit"$ git push -u origin master

Browser access:http://coderzh.github.io/

This web site, Java Union, is what I built with Hugo. This site template is written by myself (except for the Styles section), so if you have questions about Hugo's and go templates you can ask me.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.