Now that I have a gemini server setup, I went about doing the work of creating a way to automatically make a gemlog out of my WordPress blog. To be honest, bash scripting is not the best way to do that, but my thought process was to use a simple bash script that could be called by cron and that would fill in my gemlog with the latest posts from my WP blog. Praise God, it even worked! It’s still a little rough around the edges, but for under 2 hours work it seems to be a pretty decent start.
You can check out the whole project on my gitlab: https://gitlab.com/alaskalinuxuser/wp2gemlog.sh
So far, I created a shell script that uses curl to get the latest rss feed from my wp blog. From there, it converts the xml into json so I can parse it with something I know how to use: jq. Each item is pulled from the json, and run through html2text to convert it into something legible. Finally, I use a few tools such as sed and cut to change it into a gemlog format.
At this point, the script I made makes a one page gemlog that will display the 10 latest articles from my blog. The formatting could use some cleanup, but the gist of it is there. I’m actually quite pleased with the turn out, despite the need for some more changes to make it look perfect. At present, it is readable with headings for each blog post.
After I clean this one up, I was to work on a script that will separate the posts into different gemini pages and create a main page with links and an about section. I think that will look much nicer and be more functional. I could add a mariaDB as well and keep all the posts forever, but we will see. I am trying to keep it as simple as possible.
Either way, you can check it out with a gemini browser at:
gemini://alaskalinuxuser.ddns.net
linux – keep it simple.