17 September 2021
Setting up my gemlog
Hi all, I'm setting up my gemlog using gloggery.
I've created a little bash function to make it a one-step process to create a new post.
It does the following:
- Create a file with the correct naming convention for posts
- Open file in $EDITOR
- Insert post title at the top of the file, as expected by gloggery
- Run gloggery to generate files, outputting to ~/public_gemini/gemlog
- Ping antenna to let it know about the new post
The script does have a few dependencies:
- gloggery (of course), installed to ~/bin
- gemini-fetch, installed to ~/.npm/bin
- a text editor
- sed
And just for completeness, the bash function source itself, as added to .bash_aliases:
gemlog() {
slug_name=$(echo "$1" | sed -e "s/[^A-Za-z0-9._-]/_/g")
new_gemlog_file=~/.gloggery/posts/$(date -u +%Y-%m-%d-%H%M)-$slug_name
$EDITOR "$new_gemlog_file"
echo -e "$1\n\n$(cat "$new_gemlog_file")" > "$new_gemlog_file"
~/bin/gloggery -title "Armen's gemlog" -output ~/public_gemini/gemlog -url "gemini://envs.net/~armen/gemlog"
~/.npm/bin/gemini-fetch "gemini://warmedal.se/~antenna/submit?gemini%3A%2F%2Fenvs.net%2F~armen%2Fgemlog"
}