As a paying subscriber of Sourcehut I decided it would be worthwhile to take advantage of their Sourcehut Pages service. You can view an exact copy of this website at taingram.srht.site.
Inline with other services provided by sourcehut the service is pretty basic and disallows all tracking and external scripts. For that reason I will continue to host my main website separately. I collect analytics using goatcounter, which I consider a reasonable compromise between privacy and analytics. If you disagree, then please feel free to access my content through the srht.site.
Automated Website Building
I can ensure both websites will stay in sync because they are now both automatically built using builds.sr.ht. Going forward I just need to push my commits to and both sites will be automatically updated. You can see the build script here.
image: debian/testing
oauth: git.sr.ht/REPOSITORIES:RO pages.sr.ht/PAGES:RW
packages:
- emacs-nox
- elpa-htmlize
- lftp
- hut
sources:
- https://git.sr.ht/~taingram/taingram.org
- https://git.sr.ht/~taingram/emacs-init
- https://git.sr.ht/~taingram/org-publish-rss
secrets:
- 280732b2-a033-4df7-bdf5-60fbb9d0d50a
tasks:
- build-srht-site: |
mkdir srht_html
emacs -Q --batch \
--eval="(setq taingram--srht 't)" \
--eval="(defun tangle-if-windows () \"yes\")" \
--eval="(defun tangle-if-linux () \"yes\")" \
--eval="(setq taingram--base-url \"https://taingram.srht.site/\")" \
--eval="(setq taingram--publish-directory \"~/srht_html/\")" \
--eval="(setq taingram--emacs-init-directory \"~/emacs-init/\")" \
--eval="(load \"/usr/share/emacs/site-lisp/elpa/htmlize-1.59/htmlize.el\")" \
--eval="(load \"~/org-publish-rss/org-publish-rss.el\")" \
--eval="(load \"~/taingram.org/publish.el\")" \
--eval="(org-publish \"blog\")" \
--eval="(org-publish \"blog-index\")" \
--eval="(org-publish \"blog-files\")" \
--eval="(org-publish \"pages\")" \
--eval="(org-publish \"init\")" \
--eval="(org-publish \"index\")" \
--eval="(org-publish \"static\")" \
--eval="(org-publish \"css-js-xml\")"
tar -C srht_html -cvz . > site.tar.gz
- upload-srht-site: |
hut pages publish -d taingram.srht.site site.tar.gz
- build-website: |
mkdir html
emacs -Q --batch \
--eval="(setq taingram--publish-directory \"~/html/\")" \
--eval="(load \"/usr/share/emacs/site-lisp/elpa/htmlize-1.59/htmlize.el\")" \
--eval="(load \"~/org-publish-rss/org-publish-rss.el\")" \
--eval="(defun tangle-if-windows () \"yes\")" \
--eval="(defun tangle-if-linux () \"yes\")" \
--eval="(setq taingram--emacs-init-directory \"~/emacs-init/\")" \
--eval="(load \"~/taingram.org/publish.el\")" \
--eval="(require 'org-publish-rss)" \
--eval="(org-publish \"blog\")" \
--eval="(org-publish \"blog-index\")" \
--eval="(org-publish \"blog-files\")" \
--eval="(org-publish \"pages\")" \
--eval="(org-publish \"init\")" \
--eval="(org-publish \"index\")" \
--eval="(org-publish \"static\")" \
--eval="(org-publish \"css-js-xml\")"
- upload-website: |
lftp -e "mirror -R -n --ignore-time ~/html/ /html/" taingram.org
Eventually I would like to add some logic to avoid re-building pages already on my web server in order to avoid wasting resources and bandwidth. For srht.site the whole website must be uploaded as a tarball, so the only way to avoid rebuilding the whole website would be to cache a copy of every HTML page somewhere. Perhaps I can create a cache in a private git repo as a workaround. That's something I'll need to experiment with.
Comments
Email comments to comment@taingram.org.