tilde-site/content/blog/2023-01-30-tilde-site-setup.md

109 lines
3.5 KiB
Markdown
Raw Normal View History

2023-01-30 09:08:50 +00:00
+++
title = "My Tilde Site setup (2023)"
date = "2023-01-30"
updated = "2023-01-30"
[extra]
authors = ["Ydreniv"]
tags = ["indieweb", "web", "meta"]
+++
Ive finally finalized my Tilde Towm website setup.
Theres nothing too fancy, but several bricks to assemble.
## The core
The core of this setup is powered by [Zola](https://getzola.org).
This is a nice static site generator, which can be run with a single binary.
Unlike others, like Jekyll, there is no need to manage a whole Ruby/Python/…
environment.
I have put a Zola binary in my Tilde home, to use whenever I feel the need.
While typing Zola commands may be okay the first few times, I soon decided to
automate things a bit.
Ive settled on using a simple Makefile, as it is quite standard, and easy
enough to use.
```Makefile
all: build
build:
yes | ~/zola build -o ~/public_html
```
Its very simple, but means I only have to type `make` when compiling the
website.
And then, it means I can easily make things more complex.
## Indieweb
As part of my efforts to integrate this site to the Indieweb, I wamsel so be
able to send webmentions.
Ive settled on using [Pushl](https://github.com/PlaidWeb/Pushl).
Its a CLI tool which caches its previous mentions, meaning it wont send the
same twice.
So Ive added a `pushl` stage to my Makefile, which is required by the `all`
stage:
```Makefile
pushl:
. /home/ydreniv/venv-pushl/bin/activate ; pushl -c pushl-cache/ "https://tilde.town/~ydreniv/atom.xml"
```
This is great, as it means webmentions will be sent automatically, without me
having to do any cURL command manully.
However, this accentuates an issue.
How do I manage my test environment ?
## Test environment
At first, when I wanted to test something, I tested it live.
It was okay.
At most, one person would see a broken site, which would be fixed in the next
minutes.
Webmentions and feeds however make some things asynchronous.
I could mess up a link, and ending up mentioning the wrong page.
Or I could make a typo, build things, have the typo included in the feeds, and
have a feed reader collect this feed before I fix it.
While both are minor issues, it prompted me to setup a better developing
environment.
At that point, I still didnt have put anything on git.
So I got a Gitea account, and git everything.
This is not strictly needed, but its a great way to backup code or static
site.
This also means Ill be able to see things like monthly changes.
Then, I created a webspace on my personal server, with sftp access.
My workflow would be the following :
I would build things on Tilde Town, send the output via sftp to my personal
server.
Then once I have checked that everything is fine, I would do the previous
build+pushl to Tilde Town.
My current Makefile is the following :
```Makefile
all: build pushl
build:
yes | ~/zola build -o ~/public_html
pushl:
. /home/ydreniv/venv-pushl/bin/activate ; pushl -c pushl-cache/ "https://tilde.town/~ydreniv/atom.xml"
preprod:
yes | ~/zola build --base-url https://example.com/ydreniv --drafts
echo "put -r public/* www" > sftp-batch.txt
sftp -b sftp-batch.txt example.com
rm sftp-batch.txt
```
Its not perfect, and the path difference (`~ydreniv` vs `ydreniv`) means that
some links are broken.
Moreover, somehow the test server doesnt display non-ascii characters well.
And theres the issue of the sftp transfer as well.
Its very slow, and probably not optimized.
Yet its good enough for me.
Ill have to improve it further, but thats enough for now.