What is Hugo

Hugo is one of the most popular open-source static site generators. Users can quickly build their own websites using Hugo.

Setup Steps

Install Hugo

On a Mac, you can use the following command to install Hugo:

BASH
brew install hugo
Click to expand and view more

install

After installation, you can check if it’s installed properly using hugo version:

hugo_version

Create a Blog Website with Hugo

Once Hugo is installed, you can use it to create your own blog website. Use hugo new site my-blog to create a site named my-blog.

new-blog-site
After running this command, a directory named my-blog will be created in the current directory. Then, navigate into that directory and initialize it with git.

BASH
cd my-blog
git init
Click to expand and view more

Choose a Theme

After creating the website, you need to choose a theme. There are many themes available for selection: hugo themes Here, I am choosing the hugo-theme-even theme. At this point, it needs to be added as a submodule under themes/even.

BASH
git submodule add https://github.com/olOwOlo/hugo-theme-even.git themes/even
Click to expand and view more

pick-theme
After that, copy themes/even/exampleSite/config.toml to the current directory and overwrite hugo.toml

BASH
cp themes/even/exampleSite/config.toml hugo.toml
Click to expand and view more

Create a Blog Post

Once the theme is configured, you can create your own blog post. Use hugo new content/content/post/my-first-post.md to create a blog post. You can see that a new md file will appear under content/post/ after executing this command.

my-first-blog

Run Hugo

Once the previous configurations are done, you can start a Hugo server using hugo server.

Click the link to access the blog website address.
At this point, you will notice that the previously created blog does not appear; the reason is that the blog created earlier is set as draft, and it will not be displayed in hugo server mode. To show it, you need to use hugo server -D.

With this, you can complete the setup of your blog website.

Save the Local Blog to GitHub

PLAINTEXT
git remote add origin https://github.com/yourusername/myblog.git
git push
Click to expand and view more

This way, you can save your blog to GitHub.

Reference Links

  1. https://gohugo.io/getting-started/quick-start/
  2. https://github.com/olOwOlo/hugo-theme-even
  3. https://medium.com/@magstherdev/hugo-in-10-minutes-2dc4ac70ee11

Copyright Notice

Author: heyjude

Link: http://heyjude.blog/posts/how-to-create-blog-with-hugo/

License: CC BY-NC-SA 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Please attribute the source, use non-commercially, and maintain the same license.

Comments

开始搜索

输入关键词搜索文章内容

↑↓
ESC
⌘K Shortcut