Skip to main content

Hugo - Create a Simple and Beautiful Blog on Windows & Github Pages

a Little Design Tech Introduce Demo
Simple, Hugo and GitHub.


Notice!

screenshot
screenshot



Welcome to my blog.

This is a blog with Hugo and hugo-theme-itheme which deployed on Github Pages. **Hugo is a fantasy framework for building websites. If you like this project, please give the repository a star

How to Set Up HUGO Blog on Windows.

  • I find some ways to create a simple blog with Github Pages.
  • You can search the tutorial from Internet easily.
  • But I can’t set up the HUGO Blog on Windows. The Browser always give the message that Page Not Found.
  • After I try some ways and search much information, I get some experience on Windows OS.
  • I finally fix the problem.
  • Here are the following steps.

1. First

# Install Hugo.
# Set up the Windows PATH environment.

2. Second

  • Open the cmd.exe
  • Input command hugo version, it will get the correct information if you install Hugo successfully. So you can input the hugo command on CMD.exe easily.
  • Create a file used for your Hugo project. Such as C:\Downloads\Hugo\ . Then input command cd C:\Downloads\Hugo\
  • cmd.exe , Input command hugo new site blog
  • blog, it’s the name of your project name, you can input anything you want.
  • Now you can find the new file in C:\Downloads\Hugo\blog
  • The new files of the Hugo will be created in this location.Such as archetypes, layouts, static, themes, config.toml.
# Check the Hugo.
hugo version
# Input location.
cd C:\Downloads\Hugo\
# Create a new Hugo Blog.
hugo new site blog

3. Third

  • cmd.exe ,You must cd the location in blog first. cd C:\Downloads\Hugo\blog
  • cmd.exe , Input command hugo new post/first.md
  • Input and text something in the file. Such as Hello World! You can find the file in C:\Downloads\Hugo\blog\content\post\first.md
  • cmd.exe , Input command hugo new about.md
  • Input and text something in the file. Such as Hello World! You can find the file in C:\Downloads\Hugo\blog\content\about.md
  • You can find some tutorial to change the file config.toml ,C:\Downloads\Hugo\blog\config.toml

# Input location.
cd C:\Downloads\Hugo\blog
# Create a post folder and a new article.
hugo new post/first.md
# Create new about page.
hugo new about.md

4. Fourth

  • cmd.exe ,You must cd the location in blog first. Input command cd blog or cd C:\Downloads\Hugo\blog
  • cmd.exe ,Input command cd themes , The correct location is C:\Downloads\Hugo\blog\themes , Create it if you can’t find it in location.
  • cmd.exe ,Input command git clone https://github.com/floyd-li/hugo-theme-itheme.git
  • git command is the tool of Git. You must install it first. https://git-scm.com/
  • Now you download the Hugo theme - hugo-theme-itheme. You can find the location C:\Downloads\Hugo\blog\themes\hugo-theme-itheme
  • Change the file parameter of config.toml , C:\Downloads\Hugo\blog\config.toml, add the theme = 'hugo-theme-itheme'
  • The parameter of config.toml. You can find this GitHub to learn the Site Configuration with config.toml.
defaultContentLanguage = "en" # only support (en) and (zh-hans)
[params]
  defaultCover = 'https://example.com/cover.jpg' 
  email = '[email protected]' # the email address display in the footer
  [[params.socialMedia]] 
    name = 'Github'
    url = 'https://github.com/floyd-li'
  [[params.socialMedia]]
    name = 'Twitter'
    url = 'https://twitter.com/some-one'
  [[params.blogroll]] 
    name = 'Apple'
    url = 'https://Apple.com/'
  [[params.blogroll]]
    name = 'Google'
    url = 'https://Google.com/'
  • Other Command.
# Input location.
cd C:\Downloads\Hugo\blog\themes
# Clone the theme.
git clone https://github.com/floyd-li/hugo-theme-itheme.git
# Edit the config.toml

5. Fifth

  • cmd.exe ,Input command cd C:\Downloads\Hugo\blog
  • cmd.exe ,Input command hugo server -D
  • Now something display on cmd.exe, such as localhost:1313.
  • Copy localhost:1313 to your Browser such as Chrome. You can open the offline website on the browser if you succeed. Your Hugo Blog Project work fine on your Windows.
  • If you succeed to set up Hugo Blog, you just need to do step Fifth next time.
# Input location.
cd C:\Downloads\Hugo\blog
# Start Hugo on Windows.
hugo server -D
# Open Hugo blog site in browser. 
# http://localhost:1313

6. Sixth

  • But I can’t do it well on my Windows. After I input http://localhost:1313/ to Bowser what I installed. They always gave me a message that Page Not Found.
  • I finally get a useful page to fix it. https://stackoverflow.com/questions/46216333/why-my-single-page-in-hugo-returns-a-404-http-error
  • Do the same thing such as Fifth way.
  • cmd.exe ,Input command cd C:\Downloads\Hugo\blog
  • cmd.exe ,Input command hugo server -D -t hugo-theme-itheme
  • You can add the input command -t hugo-theme-itheme after hugo server -D.
  • hugo-theme-itheme can replace the name of other theme which you has installed.
  • Now something display on cmd.exe . It also has localhost:1313.
  • Copy localhost:1313 to your Browser such as Chrome. I finally get the Hugo website correctly. No error message anymore.
  • I hope that the experience is useful for you.
# Input location.
cd C:\Downloads\Hugo\blog
# Run Hugo on Windows.
hugo server -D -t hugo-theme-itheme
# Open Hugo blog site in browser. 
# http://localhost:1313

Summary

  • You can write article offline easily on your Windows.
  • Then you can upload the Hugo Blog to Github Pages easily. Please search the method on the Internet by yourself. Key words: github pages hugo.
  • I am sorry that the steps are a bit complicated. Maybe I will write a new tutorial next time.
  • You can find the GitHub to learn the Hugo usage.
  • https://github.com/floyd-li/hugo-theme-itheme

Screenshot

screenshot



Copyright: Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)