Skip to main content

Hugo - My First Post - Using Hugo with GitHub Pages

·213 words·1 min· loading · loading · ·
hugo hugo github web hosting
Luke Taylor
Author
Luke Taylor
I like a lot of things

This is my first Hugo/GitHub Pages post. And here is how it was done.

Initial setup
#

  1. Install Chocolatey

    1. Open Elevated PowerShell prompt
    Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
    
  2. Install Hugo using Chocolatey

    1. From Elevated PowerShel prompt
    choco install hugo
    
  3. Create a GitHub repo to host your site

  4. Create a Hugo Static site in a local folder

    hugo new site mySubdomain.myDomain.com
    
  5. Use the Hugo quickstart guide to fill in the blanks https://gohugo.io/getting-started/quick-start/

  6. Make sure to add a theme!

    git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke;\
    echo 'theme = "ananke"' >> config.toml
    
  7. Add a post

    hugo new posts/my-first-post.md
    
  8. Edit the .toml file to fix it up for GitHub https://gohugo.io/hosting-and-deployment/hosting-on-github/

    • publishDir = "docs"
    • baseURL = "http://blog.lukebtaylor.com/"
  9. Start the Hugo server locally with drafts enabled

    hugo server -D
    
  10. Build with Hugo

    hugo
    
  11. Add the static site folder to Git

    git add --all
    
  12. Commit the changes

    git commmit -m "my first hugo post"
    
  13. Push it to Git

    git push -u origin master
    
  14. Get up the repo as a GitHub Page

  15. Set up DNS to point to new repo

  16. End

Adding content
#

  1. Add your content using Hugo

  2. Rebuild using hugo

  3. When you’re satisfied git add --all

  4. git commit -m "I made a new post"

  5. git push -u origin master

Next Steps
#

Automated builds with Travis CI