Skip to content

GiorgosK/hugo-quick

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hugo deploying to github project pages

https://[username].github.io/[project-name]/ https://giorgosk.github.io/hugo-quick/

Deployment of Project Pages From Your gh-pages branch

This setup utilizes the automatic deployment to github pages by pushing to the gh-pages branch

Initial preparation for gh-pages Branch as described on hugo documentation

Ignore public folder in master branch

echo "public" >> .gitignore
git commit -am "Ignoring public folder in master branch"

Initialize your gh-pages branch as an empty orphan branch

# initialize branch
git checkout --orphan gh-pages
git reset --hard

# commit and puth to github
git commit --allow-empty -m "Initializing gh-pages branch"
git push origin gh-pages

# return to master
git checkout master

Build and Deployment

Setup git worktree (one time setup, kept until removed)

git worktree add -B gh-pages public origin/gh-pages

Clean public directory (optional)

rm -rf public

build the site (publishDir = "public" assumed)

hugo

Start server and make sure all works by visiting the url created

hugo serve 

Commit to gh-pages branch

cd public && git add --all && git commit -m "Publishing to gh-pages" && cd ..

Push to github

git push origin gh-pages

Github will see the gh-pages branch has changed and will automatically deploy the new version of the site

About

Hugo quick install and deployment to github project pages

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published