Creating the Site
I finally decided to bite the bullet and spin up a web site for personal and professional reasons. I’ve left far too many “webpage” fields blank in job application forms. now there were a few objectives to meet in completing this project so let’s go over them.
objectives
- the site should have little or no frills
- no js
- no css
- cheap, reliable hosting
- not interested in self hosting at home
- don’t want to manage cloud resources
- automated publishing
- no way to get around editing and writing the files but publishing new content should be as easy as
git push
- no way to get around editing and writing the files but publishing new content should be as easy as
research
considering objective number one I started looking at web pages with a small footprint. You can find a well maintained list of these at 1mb.club. it should be obvious but the smallest sized pages were of course, html only. and I was fully ready to commit to this until I ran across hugo. this would simplify the new content workflow a bit and they had a breadth of minimal themes that would allow me to stay true to the outline. this solves objective one.
objectives two and three fell into my lap without much effort. I noticed some of the 1mb club sites were hosting on sr.ht. looking into this option for a few minutes solidified that as my solution. for twenty bucks a year I get git repo storage, a tool to automate publishing, secret management, and static site hosting (among other things).
implementation
so I had my list of tools, let’s go over them now.
- hugo
- simple web site framework
- lets me write pages as markdown
- has nice themes
- nice cli workflow for testing and adding new content
- sr.ht
- otherwise known as sourcehut
- nice opensource github alternative
- cheap repo storage, build automation, secret manager, and static site hosting!
- cloudflare
- cheap domain registrar with some nice supplemental features
- afaik they are pretty honest so I don’t mind buying from them
at this point I created my sr.ht account ($20/year), bought my domain name via cloudflare (was already using them), and setup my development environment. after about a day of tinkering with hugo I had my site layout and my workflow worked out. on day two I setup and troubleshot the automated publishing part, which if you are already aware of github actions, sr.ht has the same feature.
speedbumps
the entire process was relatively straightforward except for three instances.
- the submodule problem
- the hugo documentation will instruct you to
git submodule add
your theme of choice into yourthemes
directory. this is all fine and dandy until you realize you are going to be making substantial edits to the theme files. - what you want to do before you
git submodule add
is fork your own copy of the theme repo into sr.ht and then add your fork as the submodule.
- the hugo documentation will instruct you to
- the build manifest problem
- the documentation will make it sound like you are able to clone your public repos with no credentials in the automated builds. this is not true.
- create a secret in the secret manager with your private key and add that to your build manifest.
- I ended up going with “unlisted” repos (something github doesn’t even have)
- the cloudflare proxy problem
- by default cloudflare will attempt to proxy requests to your domain before sending it along to the
A
andAAAA
records you setup. - the sr.ht cli tool
hut
wasn’t liking that when I attempted to publish the first time. - the proxy service has to be disabled.
- if you’re with another domain registrar you may not run into this issue.
- by default cloudflare will attempt to proxy requests to your domain before sending it along to the
conclusion
here’s what the final workflow looks like to push a new blog post.
cd
to my hugo projecthugo new content content/posts/new-blog.md
- construct my new post in markdown
git add
,git commit
, andgit push
the push to sr.ht will spit out a build link if I feel inclined to verify it. in the future I can see adding more complex content but for now this is exactly what I set out to accomplish. immediate next step that comes to mind is to look into the cloudflare proxy issue. i’d like to enable that if possible.
the two unlisted repos for this site are linked below. nostyleplease is the name of the hugo theme I forked. if you want to see what the build script looks like its in the zarekonline repo under .build.yaml
.