How to build a site from scratch with Hugo

step by step guid to build a site with Hugo

This is a walk through on how to build a site from scratch with Hugo.

# create a repo on github called blog to host our actual blog code and drafts and stuff also called BLOG REPO.

# create a repo on github sirajudheenam.github.io to host our static assets also called PRODUCTION REPO

brew install hugo

# clone the blog github repo locally 
git clone git@github.com:sirajudheenam/blog.git
cd blog
hugo new site sirajudheenblog
cd themes
# Pick a theme.
git clone https://github.com/zerostaticthemes/hugo-whisper-theme.git hugo-whisper-theme
cd ..
nvim config.toml

baseURL = "https://sirajudheenam.github.io/"
languageCode = "en-us"
title = "Sirajudheen Blog"
config = "hugo-whisper-theme"
# save and exit

hugo server

# Visit http://localhost:1313

# Add new post to it.
hugo new posts/my-first-post.md

nvim posts/my-first-post.md
# change the title
title: "This is great title"

---

# save and exit

cd ~/Desktop
git clone git@github.com:sirajudheenam/sirajudheenam.github.io.git 
cd sirajudheenam.github.io
git checkout -b main

echo "#sirajudheenam.github.io" > README.md
git add .
git commit -m "initial commit"
git push origin main

cd ~/Desktop/blog/sirajudheenblog

git submodule add git@github.com:sirajudheenam/sirajudheenam.github.io.git public

cd public
ls 
README.md

cd ..
hugo server

# Visit http://localhost:1313 to check everything works properly

# build the site in to public folder
hugo -t hugo-whisper-theme

cd public
ls

git remote -v

git status

git add .
git commit -m "initial commit"
git push origin main

This will get deployed on github pages

Visit https://sirajudheenam.github.io