How to Build a Stylish Website with Hugo: A Step-by-Step Guide

If you’re looking to create a fast, lightweight static website with images, custom designs, and content management, Hugo is one of the best tools out there! Whether you’re building a portfolio, a personal website, or a business site, Hugo’s flexibility and speed will get you up and running quickly.

In this blog post, we will walk through how to create a Hugo website with images, apply custom designs, and deploy it to the web.

Why Use Hugo?

Hugo is a static site generator that allows you to build websites with great speed and efficiency. It’s incredibly popular for personal blogs, portfolios, documentation websites, and more. Since Hugo generates static HTML files, your website will be fast and easy to deploy. Plus, it works well with themes, images, and custom CSS.

Step 1: Set Up a New Hugo Website

The first step is to set up a new Hugo website. If you’ve already worked with Hugo before, you might have created a blog site. For this tutorial, we will build a complete website with dynamic pages, images, and custom designs.

1.1 Create a New Hugo Site

  1. Open PowerShell on your system and navigate to the folder where you want to create the site: cd C:\Users\YourUsername\Documents
  2. Run the following command to create a new Hugo site: hugo new site mywebsite
  3. Navigate to the newly created mywebsite directory: cd mywebsite

Step 2: Choose a Theme for Your Website

Hugo uses themes to define the design and layout of your website. To get started, we’ll choose a simple and elegant theme called Ananke.

2.1 Install the Theme Using Git

  1. Initialize the Git repository: git init
  2. Add the Ananke theme: git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
  3. Open the config.toml file and add the theme configuration: notepad config.toml
  4. Add this line at the top: theme = "ananke"
  5. Save and close the config.toml file.

Step 3: Add Content to Your Website

Now that your theme is set up, let’s start adding content to your website, such as pages and images.

3.1 Create Pages

To create a new page like an About Us page, run this command:

hugo new about.md

This will create a new file called about.md in the content folder.

3.2 Edit the Content of the Page

Open the about.md file to add your content:

notepad content/about.md

Here’s an example of content you might add:

---
title: "About Us"
date: 2025-02-14T10:00:00+05:30
draft: false
---

## Welcome to Our Website!

We are a team of professionals dedicated to delivering the best services to our customers. Our mission is to provide **high-quality** resources to help you make informed decisions.

![Our Team](images/team.jpg)

Feel free to explore the rest of the website, and let us know if you have any questions!

3.3 Add Images

  1. Create an images folder inside the static directory: mkdir static/images
  2. Upload your images (e.g., team.jpg) into the static/images/ folder.
  3. In your content (like the About Us page), use the images like this: ![Team Image](images/team.jpg)

Step 4: Customize Your Website’s Design

Let’s make your site truly unique by customizing the CSS and HTML files.

4.1 Edit the CSS

Themes come with predefined CSS files, but you can easily modify them to suit your needs.

  1. Navigate to the themes/ananke/static/css/ folder: cd themes/ananke/static/css/
  2. Open the style.css file and add your own styles. For example: body { background-color: #f8f8f8; font-family: 'Arial', sans-serif; } h1 { color: #2c3e50; } .custom-header { background-color: #008CBA; padding: 20px; color: white; }

4.2 Edit HTML Layouts

To further customize the layout, navigate to:

themes/ananke/layouts/

You can modify the header, footer, or sidebar files to fit your design.

Step 5: Run the Hugo Server Locally

Let’s see how your site looks by running the Hugo server.

  1. In PowerShell, run: hugo server -D
  2. Open your web browser and go to: http://localhost:1313

Your site should now be live locally with your images, content, and custom design!

Step 6: Build the Site for Deployment

Once you’re happy with the local preview, you can build the site into static HTML files ready for deployment.

  1. Stop the Hugo server by pressing Ctrl + C.
  2. Generate the static files with the following command: hugo
  3. This will generate a public/ folder containing the HTML files of your site.

Step 7: Deploy Your Website

Now that you have the static HTML files in the public/ folder, it’s time to deploy your site to the web!

7.1 Deploy to GitHub Pages

You can use GitHub Pages to host your Hugo site. Follow the official GitHub Pages deployment guide to get started.

7.2 Deploy to Netlify

  1. Go to Netlify.
  2. Drag and drop your public/ folder into the dashboard to deploy the site instantly.

7.3 Deploy to Any Web Hosting

Upload the contents of your public/ folder to any web hosting provider of your choice (e.g., via FTP, cPanel, etc.).

Conclusion

Building a Hugo website with images and custom designs is a simple process that offers great flexibility and speed. By following these steps, you’ve created a customized static website that’s ready for deployment. Whether you’re using GitHub Pages, Netlify, or any hosting provider, you can now easily share your website with the world!

Related Posts

How Quantum Computing Will Supercharge Database Searches

Introduction Every single day, we create an incredible amount of digital information. From the billions of emails sent every morning to the millions of photos uploaded every…

Read More

Platform Engineering Roadmap: An Easy Guide for Beginners

Introduction Starting a career in the cloud can feel like facing a huge wall of tools. There are hundreds of them. Each one has a strange name….

Read More

How Quantum Algorithms Solve Factoring Problems: A Simple Guide

Introduction Imagine a giant, heavy vault holding all of your deepest secrets. The lock on this vault is a math puzzle so incredibly hard that a normal…

Read More

A Simple Guide to DevOps Learning and Cloud Skills for Teams in Japan

Introduction Software moves fast today. New updates ship every week. Some teams ship every day. Many firms in Japan feel this pace. Their teams want to move…

Read More

Introduction to Shor’s Algorithm: How Quantum Computers Could Break Today’s Internet Locks

Introduction Every time you log in to your bank, send a private message, or buy something online, a quiet piece of math is working in the background….

Read More

Egg Freezing Cost: Treatment Expenses and Important Cost Factors

Building a family should feel exciting and joyful. Yet, many people face deep sadness and worry along the way. Finding clear medical guidance often feels like solving…

Read More
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x