# Getting Started with Hugo: Build Your Static Blog

Source: https://brightonxu.com/posts/2026-01-19-getting-started-with-hugo/

Author: Brighton (Yi Xu)
Published: 2026-01-18

从安装到部署 GitHub Pages 的完整指南

Hugo is a fast and flexible static site generator that makes building websites fun again. In this post, I'll share my experience of setting up this blog with Hugo and deploying it to GitHub Pages.

## Why Hugo?

When I decided to start a blog, I evaluated several options:

- **WordPress**: Powerful but requires database and hosting
- **Jekyll**: Good, but slow build times for large sites
- **Hugo**: Blazing fast, single binary, no dependencies

Hugo won me over with its speed - it can build this entire site in under 100ms!

## Installation

Installing Hugo is straightforward:

```bash
# On macOS with Homebrew
brew install hugo

# Verify installation
hugo version
```

## Creating Your First Site

```bash
# Create a new site
hugo new site my-blog

# Add a theme (using cleanwhite theme)
cd my-blog
git submodule add https://github.com/zhaohuabing/hugo-theme-cleanwhite themes/hugo-theme-cleanwhite
```

## Writing Your First Post

```bash
# Create a new post
hugo new posts/my-first-post.md
```

Edit the markdown file with your content. Remember to add a cover image:

## Building and Deployment

Build your site:

```bash
hugo --minify
```

The generated files will be in the `public/` directory, ready for deployment.

## GitHub Pages Deployment

The easiest way to deploy is using GitHub Actions:

1. Push your Hugo site to GitHub
2. Enable GitHub Pages in repository settings
3. Add the GitHub Actions workflow file
4. Push changes - automatic deployment!

## Tips and Tricks

### Organization

- Keep your images in `static/img/`
- Use `tags` and `categories` for better content organization
- Create `_index.md` files for section pages

### Performance

- Always use `--minify` flag for production builds
- Optimize images before adding them
- Enable caching headers on your server

### Content

- Use `<!-- more -->` to create summary/excerpt on homepage
- Add meaningful tags for better discoverability
- Write compelling descriptions for SEO

## Conclusion

Hugo makes blogging simple and fast. This entire blog was built with Hugo, and I'm happy with the results. The combination of Hugo + GitHub Pages provides a free, fast, and reliable hosting solution.

Have questions? Feel free to reach out or leave a comment below!

---

Happy blogging! 🚀
