A php script to dump all posts of a WriteFreely blog as a gemini protocol folder ready to server with agate. It also dumps files as .gph and .txt files to serve your gopher files with another server (I use gopher://bitreich.org/1/scm/geomyidae/). This allows you to publish your gopher texts as ISO-8859-1 if you want . WriteFreely defaults to UTF-8 and currently has no option to change this. Publishing as old ISO-8859-1 encoding makes it possible to have accents on your Amiga or old Mac clients.
Find a file
2026-02-03 04:13:24 +00:00
bin dirty html 2026-02-03 02:50:13 +00:00
.htm dirty html 2026-02-03 02:50:13 +00:00
.txt basic gopher dump for geomyidae 2026-01-17 19:29:17 +00:00
config.php html header for old version 2026-02-03 04:13:24 +00:00
README.md updated readme: 2026-01-17 23:03:39 +00:00
update_gmi_content.php html header for old version 2026-02-03 04:13:24 +00:00

writefreely to gemini

This is a quickly hacked PHP script that will get the latests posts in your sqlite database and create .md and .gmi files to serves as a gemini protocol file. It uses gemgen command line for the markdown to gemtext translation.

It also creates .txt files for use with a gopher server. I use geomyidae. Encoding can be set in config file which defaults to ISO-8859-1 to work on all old computers. Txt files are also ouptut with 80 columns word wrapping.

This was created for https://lacra.ia.br/

This just select the date of the most recently updated post. If it is more recent than a stamp file it updates everything. Not an issue for a few hundred posts but this might need optimisation in the future if this ever gets used on a larger scale to only update changed posts.

Usage

Edit config.php and put something like this in your cron tab

5 * * * * cd /home/lacraia/writefreely_to_gemini && php -f update_gmi_content.php > /home/lacraia/logs/gmi_update.log 2>&1

License

Please do what the fuck you want with this.

Comments ?

Message me on the fediverse or drop me a mail