Skip to main content
  1. Posts/

How I Setup My Website

·613 words·3 mins· 0 · 0 ·
Website Hugo
Table of Contents
Author
Armoghan-ul-Mohmin

This shows you have I automate my workflows and setup my website for maximum productivity and search.

The best part is this is FREE and will produce a website faster than anything on the web.

Prerequisites #

Before you begin this tutorial you must

  1. Install Hugo
  2. Install Go
Note! You must also be comfortable working from the command line.

Create a site #

Commands #

  1. If you are a Windows user

    • Do not use the Command Prompt.
    • Do not use Windows PowerShell
    • Run these commands from PowerShell or a Linux terminal such as WSL or Git Bash
    PowerShell and Windows PowerShell are different applications.

Run these commands to create a Hugo site with the Blowfish theme. The next section provides an explanation of each command.

hugo new site quickstart
cd quickstart
git init
git submodule add https://github.com/nunocoracao/blowfish.git themes/blowfish
echo "theme = 'blowfish'" >> hugo.toml
hugo server

Explanation of commands #

Create the directory structure for your project in the quickstart directory.

  1. Create New Hugo Project.
hugo new site quickstart
  1. Change directory to your project.
cd quickstart
  1. Innitialize Git Repo.
git init
  1. Clone the Blowfish theme into the themes directory, adding it to your project as a Git submodule..
git submodule add https://github.com/nunocoracao/blowfish.git themes/blowfish
  1. Append a line to the site configuration file, indicating the current theme.
echo "theme = 'blowfish'" >> hugo.toml
  1. Start Hugo’s development server to view the site.
hugo server
View your site at the URL displayed in your terminal. Press Ctrl + C to stop Hugo’s development server.

Add content #

Add a new page to your site.

hugo new content posts/my-first-post.md

Hugo created the file in the content/posts directory. Open the file with your editor.

---
title: "My First Post"
date: 2023-09-08T13:42:05+05:00
draft: true
---

Notice the draft value in the front matter is true. By default, Hugo does not publish draft content when you build the site. Learn more about draft, future, and expired content.

Add some markdown to the body of the post, but do not change the draft value.

---
title: "My First Post"
date: 2022-11-20T09:03:20-08:00
draft: true
---
## Introduction

This is **bold** text, and this is *emphasized* text.

Visit the [Hugo](https://gohugo.io) website!

Save the file, then start Hugo’s development server to view the site. You can run either of the following commands to include draft content.

hugo server --buildDrafts
hugo server -D

View your site at the URL displayed in your terminal. Keep the development server running as you continue to add and change content.

Configure the site #

With your editor, open the site configuration file (hugo.toml) in the root of your project.

baseURL = 'http://example.org/'
languageCode = 'en-us'
title = 'My New Hugo Site'
theme = 'blowfish'

Make the following changes:

  1. Set the baseURL for your production site. This value must begin with the protocol and end with a slash, as shown above.
  2. Set the languageCode to your language and region.
  3. Set the title for your production site.

Start Hugo’s development server to see your changes, remembering to include draft content.

hugo server -D
Most theme authors provide configuration guidelines and options. Make sure to visit your theme’s repository or documentation site for details.

Publish the site #

In this step you will publish your site, but you will not deploy it.

When you publish your site, Hugo creates the entire static site in the public directory in the root of your project. This includes the HTML files, and assets such as images, CSS files, and JavaScript files.

When you publish your site, you typically do not want to include draft, future, or expired content. The command is simple.

hugo

To learn how to deploy your site, see the hugo hosting and deployment section.

Related

Getting Started With Hugo
·775 words·4 mins· 0 · 0
Linux MacOS Windows Hugo
How to Create a Simple Website using Hugo
Hugo (Static Site Generator)
·1021 words·5 mins· 0 · 0
Linux MacOS Windows Hugo
An Introduction to Hugo Static site Generator
WordPress on Docker
·1073 words·6 mins· 0 · 0
Linux MacOS Windows WordPress
How to Install WordPress on Docker (Windows, macOS, and Linux)

Join the Newsletter