feat(blog): Tilde Site Setup (2023)

This commit is contained in:
ydreniv 2023-01-30 09:08:50 +00:00
父節點 cec3fe6327
當前提交 08688bd2e8
共有 2 個檔案被更改,包括 112 行新增1 行删除

查看文件

@ -1,4 +1,7 @@
all: build pushl all:
echo 😠
prod: build pushl
build: build:
yes | ~/zola build -o ~/public_html yes | ~/zola build -o ~/public_html

查看文件

@ -0,0 +1,108 @@
+++
title = "My Tilde Site setup (2023)"
date = "2023-01-30"
updated = "2023-01-30"
[extra]
authors = ["Ydreniv"]
tags = ["indieweb", "web", "meta"]
+++
I’ve finally finalized my Tilde Towm website setup.
There’s 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.
I’ve 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
```
It’s 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.
I’ve settled on using [Pushl](https://github.com/PlaidWeb/Pushl).
It’s a CLI tool which caches it’s previous mentions, meaning it won’t send the
same twice.
So I’ve 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 didn’t have put anything on git.
So I got a Gitea account, and git everything.
This is not strictly needed, but it’s a great way to backup code or static
site.
This also means I’ll 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
```
It’s not perfect, and the path difference (`~ydreniv` vs `ydreniv`) means that
some links are broken.
Moreover, somehow the test server doesn’t display non-ascii characters well.
And there’s the issue of the sftp transfer as well.
It’s very slow, and probably not optimized.
Yet it’s good enough for me.
I’ll have to improve it further, but that’s enough for now.