💾 Archived View for capsule.galusik.fr › log › 2022-10-23-new-blog-workflow.gmi captured on 2023-05-24 at 17:46:56. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-04-19)

➡️ Next capture (2024-05-10)

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

New blog workflow: from markdown to gemtext

2022-10-23

Previously

I was using babille[1], a python script that build a static site from markdown files. Babille is batteries included : blog, RSS, pages, sitemap, templates...

But, but, but, I don't want to write with the markdown text format anymore and I don't want to maintain a python script. Moreover, I want a Gemini capsule :P

https://git.sr.ht/~fredg/babille[1]

GemText or OrgMode

I want to write my (b)log posts in the most easy and quick way. GemText[2] is some kind of very (very) light markdown. I choose that one over orgmode for its simplicity and because converting orgmode to gemtext was not as effective as I want. So, you just write and you don't bother with the formatting things because, there are none, or almost none :D.

GemText specs[2]

From markdown to gemtext

I had to convert my old blog posts to fit on the gemini server. But there was more than the format, headers had to be converted too. I wrote this little script to do the job:

https://git.sr.ht/~fredg/capsule.galusik.fr/tree/master/item/togmi.sh

#!/bin/sh
#
# togmi.sh
#
# Bulk convert title.md files with header like below:
# Title: your_title
# Date: xxxx-xx-xx
# Category: your_tag
#
# TO gemini gmi files date-title.gmi (required for the gemlog index)
# with header below:
# # your_title
# reformated date in the 2nd line 
# No more category
# Cleanup empty lines
#
# copy (do backup!!) your md files to the mdposts directory
# You need lowdown to convert your markdown files to gemtext ones
# run the script.
#
# LICENCE: WTFPL

set -eu

# .gmi files dir
LOGDIR=log
mkdir -p "${LOGDIR}"

# move to md files dir
MDFDIR=mdposts
cd "${MDFDIR}"

for f in *.md
do
    D=$(grep Date ${f} | awk '{ print $2 }')
    sed -i -e 's/Title:/#/' -e "s/^Date.*$/${D}/" -e 's/^Category.*$//' "${f}"
    lowdown -Tgemini -o "${D}-${f%.md}.gmi" "${f}"
done

for g in *.gmi
do
    sed -i '2d' "${g}"
done

mv *.gmi ../"${LOGDIR}"
rm *.md

cd -
echo done!!!

Shinobi? Atom feed?

In the beginning I was planning to move to a shinobi[3] website. It is a text-based, RSS focused blogging system. No more HTML, no more website in a classical way. But I thought that I couldn't force people to use a newsreader. This is why I have decided to convert my gemlog to html and to offer an atom feed based on the gemtext posts.

For the last one, I let you read prx's post[4], it's all that you need to build a beautiful atom feed that you can read from any web browser too.

shinobi[3]

https://si3t.ch/log/2022-06-15-how-to-atom-feed.xhtml[4]

gemini://si3t.ch/log/2022-06-15-how-to-atom-feed.gmi[4]

From gemtext to html

For that I was planning to make a quick and dirty script first but as usual, prx[5] has already thought about it :P.

https://si3t.ch/log/2022-09-29-gmi2xhtml-v6.xhtml[5]

gemini://si3t.ch/log/2022-09-29-gmi2xhtml-v6.gmi[5]

From markdown to orgmode

For the homepage, the contact page, the about one and for my writer page, I want to use orgmode and the powerfull publish emacs engine. For those fourth pages, I did the conversion to orgmode live through emacs.

Workflow

At the end, the workflow is like this:

To (b)log

https://git.sr.ht/~fredg/capsule.galusik.fr/tree/master/item/capsule.sh

Be aware that this script does the job but it can surely be improved ;).

To update the website

TODO

<--

Commentaires / Comments ?

Envoyer un email à la liste de discussion publique / Send a mail to the public Inbox

---

-- Copyright © 2008–2023 Frédéric Galusik - CC BY-SA 4.0 --