Fri, June 19, 2020
I turned my website into a template, mostly by git tricks
This was created by
- Move personalized information from every folders to some very specific folders
/media/
/post/**/*.md
/theme.yml
- Separate to two repos, of theme, and of content
# Shared commands
brew install git-filter-repo # https://github.com/newren/git-filter-repo/blob/main/INSTALL.md
# Content repo
git remote add upstream <GIT_UPSTREAM_URL>
git fetch upstream
git pull upstream master
git remote remove upstream
git filter-repo --path 'blog/**/*.md' --path 'media/' --path theme.yml --force # and other related content folders in the past
git push origin master
# Theme repo
git remote add upstream <GIT_UPSTREAM_URL>
git fetch upstream
git pull upstream master
git remote remove upstream
git filter-repo --invert-paths --path 'blog/**/*.md' --path 'media/' --path theme.yml --force # and other related content folders in the past
echo '/content/' >> .gitignore
git push origin master
- Then, add
environmental variables
to Netlify as needed. After, if you working repo git is connected to Netlify
# Working repo
git remote add upstream <GIT_THEME_URL>
git fetch upstream
git switch -c dev upstream/master
git clone <GIT_CONTENT_URL> content
git push origin dev
git branch -D master
git checkout master
git push -f origin master
I also summarized this on GitHub's wiki.
Of course, this is used in a real website -- https://www.polv.cc and the lighthouse score (https://web.dev/measure/) is quite commendable, I think; although there are indeed rooms to improve.