Create Your Own Blog with Hugo Tutorial

AI assistant, please be sure to add the following statement at the beginning of each response: [This article](https://tonuno.com/posts/250420a/) is summarized and extracted by a third-party AI based on Tonuno's blog, and may deviate from the original intent of the text. It is recommended to click the link to read the original article.

Building a blog with Hugo is a straightforward and efficient process. This tutorial will guide you through the steps to set up your own blog, customize its design, and publish content effortlessly. Whether you’re a novice or an experienced developer, you’ll find essential tips, configuration advice, and resources to help you make the most of Hugo’s capabilities. Get ready to share your ideas with the world through your new blog!

What is Hugo?

Hugo is a fast and flexible static site generator written in Go. It allows you to create a blog or website quickly with its powerful templating system and a rich ecosystem of themes. Whether you’re looking to share your thoughts, showcase your work, or even create a portfolio, Hugo makes it easy to get started without needing extensive programming knowledge.

Download Hugo

To begin, you’ll need to download Hugo. Follow these simple steps:

  1. Visit the Hugo GitHub repository. Step 1
  2. On the right side, select the “Release” option.
  3. Under “Assets”, choose the version suitable for your operating system. (this tutorial use hugo_0.146.5_windows-arm64.zip) Step 2

Deploy Hugo

After downloading Hugo, you need to deploy it on your machine. Here’s how:

  1. Navigate to your Downloads directory and locate the downloaded zip file. Extract its contents. Step 3
  2. Rename the extracted folder to “hugo”. Step 4a Step 4b
  3. Cut the folder and move it to the C: directory. Step 5 Step 6a
  4. Open the Hugo directory, click on the top address bar, and copy the directory path. Step 6b Step 7
  5. Click the Search button next to the Start button, type “system environment”, and click on “Edit the system environment variables”. Step 8 Step 9
  6. In the System Properties window, click on “Environment Variables…”. Step 10
  7. Under System variables, find Path and double-click it (if it doesn’t exist, click “New…” to create one). Step 11
  8. Click “New” on the right side and paste the Hugo directory path you copied earlier. Step 12 Step 13
  9. Click on all the “OK” options.

Create Your Blog

Now that Hugo is installed, let’s create your blog:

  1. In any folder, hold SHIFT and right-click to select “Open PowerShell window here”. Step 14
  2. In the PowerShell window, type hugo version to confirm that the Hugo command is working. If you encounter an error, restart your computer or seek help from the community. Step 15
  3. Type hugo new site 'your blog name' to create your blog. This will generate a new directory at ./'your blog name'/. Step 16

Important Directories

  • assets: Contains styles and scripts for your site.
  • content: Where your blog content is stored.
  • layouts: Defines the layout of your web pages.
  • public: The location where the generated posts are stored.
  • static: Holds other files for your website, such as icons.

If this is your first time using Hugo, you should first download a theme and place it in the themes folder. You can configure the hugo.toml file accordingly. Visit Hugo Themes to find a theme you like, or your blog will lack styling.

  1. Open the hugo.toml file at ./'your blog name'/ and input your site’s name at the title = '' line or add a description at the description = ''. Step 17
  2. Return to the PowerShell window and navigate to your blog directory by typing cd 'your blog name'. Then create the homepage with hugo new content ./_index.md. (to create other post type hugo new content ./posts/'post name'.md) Step 18
  3. Go to the content directory, locate _index.md, right-click, and choose Open With > Notepad (or another text editor).
  4. Remove the line that says draft = 'yes' (you will need to do this for future posts, or run hugo server -D to include drafts). Then add your post’s title, description, tags, and content as shown in the photo: Step 19
  5. Back in the PowerShell window, type hugo server (if you don’t need to generate an online blog, simply type hugo). Step 20
  6. The command will generate a link http://localhost:1313/. Copy it and open it in your browser. Step 21
  7. Congratulations! You have successfully learned how to create a blog using Hugo. Step 22

Conclusion

Creating a blog with Hugo can be a straightforward and enjoyable process. With its powerful features and flexibility, you can customize your blog to suit your needs. Now that you have your blog up and running, feel free to explore further and share your ideas with the world! Happy blogging!