Skip to content

Instantly share code, notes, and snippets.

@altanner
Last active January 19, 2023 12:28
Show Gist options
  • Save altanner/a0397fb4dd1a0615dc0d0035fb36515a to your computer and use it in GitHub Desktop.
Save altanner/a0397fb4dd1a0615dc0d0035fb36515a to your computer and use it in GitHub Desktop.
Reminder of how to make a new Hugo themed github pages site
#latest first
create REPONAME on github
mkdir REPONAME
cd REPONAME
git init
hugo new site site-build
cp -r ../data-vis-with-streamlit/site-build/content site-build
cp -r ../data-vis-with-streamlit/site-build/themes/LoveIt_local site-build/themes
cp ../data-vis-with-streamlit/site-build/hugo_extended_0.98.0_Linux-64bit.deb site-build
cp ../data-vis-with-streamlit/site-build/config.toml site-build/config.toml
## EDIT THE toml FILE TO FIT NEW SITE
## add hideReadingTime = true in the [params] section of site-build/config.toml
mkdir docs
touch docs/placeholder
mkdir .github
mkdir .github/workflows
cp ../data-vis-with-streamlit/.github/workflows/push-deploy.yml .github/workflows
### edit push-deploy.yml (main / master might be wrong)
# push it all
git remote add origin [email protected]:alleetanner/REPONAME.git
git add .
git commit -m "up"
git push --set-upstream origin main
# then go to GH and set pages to deploy from /docs
# also change Settings>Actions>General to "read and write permission granted"
## ISSUE: still displaying sections as blog posts, in reverse date order, with text too large
# this will put things in the right order, but still to large :/
cp -r ../data-vis-with-streamlit/site-build/layouts site-build
# remove stupid word count and read time by editing the post-meta block out of
./site-build/layout/posts/single.html
#OLDER VERSION,
# make a new repo folder
mkdir folder && cd folder
# turn it into a repo
git init
# get that git ignore (find in another repo)
cp ../data-vis-moving-files/.gitignore .
# tell hugo to make a new site, in a folder called "site-build"
hugo new site site-build
# add the submodule into the right folder
git submodule add https://github.com/dillonzq/LoveIt.git site-build/themes/LoveIt
# [make an [API key in github Developer Settings section]
# change "data3" here to the repo name. generated access key is password
curl -u alleetanner https://api.github.com/user/repos -d '{"name":"data3","private":false}'
### OR > just create a new empty repo on GH
# set remote
git remote add origin [email protected]:alleetanner/REPONAME.git
# do a push
git add .
git commit -m "up"
git push --set-upstream origin main
# add config and content as a template so something is pushed
cp ../data-vis-moving-files/site-build/config.toml site-build
cp -r ../data-vis-moving-files/site-build/content site-build
# get the .deb file (find it in another repo) so actions can use it
# this should be in site-build
cp hugo_extended_0.98.0_Linux-64bit.deb site-build
# build the site
cd site-build
hugo -t LoveIt
# make a docs folder in root
mkdir docs
# add something to it so it is pushable
touch docs/placeholder
# get the GH actions workflow file (find it in another repo)
cp -r ../data-vis-moving-files/.github .
# do another push
# site should be built with this push
git add .
git commit -m "up"
git push
### back in browser, set GH pages to be on, sourced to /docs
### I know, this will cause me headaches all over again :/ sorry future me.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment