💾 Archived View for wilw.capsule.town › log › 2023-06-01-automatic-gemini-publishing.gmi captured on 2024-08-18 at 17:20:35. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-06-14)

-=-=-=-=-=-=-

🏡 Home

Back to gemlog

Cross-publishing web content to Gemini

Posted on 01 June 2023

My personal website is generated using Hugo [1], which allows me to write nearly all of the actual content itself in plain markdown files.

1

I also maintain a Gemini capsule (hosted at gemini://wilw.capsule.town [2]). For a while I've wanted to be able to add more content to this capsule, and to try and keep it updated more consistently over time. However, I don't really have the capacity to duplicate the time taken to maintain the site (and its blog posts [3] and notes [4]) in order to do so.

2

3

4

Whilst Gemini text format is _not markdown [5]_, it is similar enough that I wondered if I could script a simple translation flow to turn my `*.markdown` files into valid `.gmi` ones.

5

At the end of the day, it is up to the Gemini clients themselves to decide how to render content, and so the main thing I really needed to handle were links (which can't be rendered in-line in Gemini) and images (which cannot be displayed).

Using the `python-frontmatter` [6] package, I was able to write a quick builder script [7] which now helps to populate my Gemini capsule.

6

7

The script creates new Gemini files for each of my blog posts and notes, and also generates index files to allow navigation to this content. In each file, links are extracted out of the main text, and replaced with indexed references (e.g. `[3]`), which are then placed as valid Gemini links after each paragraph.

If an article has links referencing another blog post or note, then the links are generated using the `gemini://` protocol, allowing the visitor to stay in Gemini as much as possible.

The script is executed as part of my Woodpecker CI pipeline [8] to automate the generation of the Gemini capsule on each `git push`. The output is then automatically deployed to gemini://capsule.town [9] in order to make the changes live.

8

9

It's great knowing that I can now keep the capsule up-to-date as part of my usual workflow.

Reply via email

Back to gemlog