Skip to content

Instantly share code, notes, and snippets.

@mefuru
Last active May 21, 2021 16:36
Show Gist options
  • Save mefuru/25ffa3d67aabe3affd7b7a8ab62fbcac to your computer and use it in GitHub Desktop.
Save mefuru/25ffa3d67aabe3affd7b7a8ab62fbcac to your computer and use it in GitHub Desktop.
Instructions for setting up a Hugo site hosted on GitHub pages

Hey, this is how I set up personal site using Hugo, hosting it on Github pages and linked it to a domain bought through Google domains. Let me know if you have any questions!

  • Install Hugo (Mac)
> brew install hugo
> hugo new site SITE_NAME
> hugo new post/test-post.md
  • Download a theme and add to project e.g.
> git submodule add [email protected]:mismith0227/hugo_theme_pickles.git themes/pickles
  • Use example site to get it up and running quickly
> cp -a themes/THEME_NAME/exampleSite/* .
  • Update config.toml to reflect theme change. This may involve changing the themesDir and theme fields. e.g.
> themesDir = "themes"
> theme = "pickles"
  • Github pages the site to be in a docs dir. Change config as follows
> publishDir = "docs"
  • Run generator - make the site!
> hugo
  • Create new repo on github.com
  • Init new repo on parent dir and add remote url
> git more add origin REPO_ADDY
  • Add, commit and push changes
> git add .
> git commit -am 'init'
> git push origin master -u
  • Go to settings for repo on Github > Github pages > Source > select docs
  • May need to edit .gitmodules folder and change url to theme homepage rather than repo url e.g.
> [submodule "themes/pickles"]
	> path = themes/pickles
	> url = https://github.com/mismith0227/hugo_theme_pickles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment