[POST] Rework "How this post is brought to you..." post

This commit is contained in:
Marcel Kapfer 2023-03-22 21:26:50 +01:00
parent 2e68bd016e
commit 503c4ed998
Signed by: mmk2410
GPG Key ID: CADE6F0C09F21B09
1 changed files with 23 additions and 5 deletions

View File

@ -1143,15 +1143,33 @@ After posting a link to this post on my [[https://fosstodon.org/@mmk2410][Mastod
:EXPORT_FILE_NAME: 100dto-how-this-post-is-brought-to-you.md
:END:
The #100DaysToOffload challenge starts very well. I'm sitting here at my desk with the to-do in front of me to write post number two. And I have absolutely no idea what to write! Well, there are some topics I want to cover on the blog during the next months and the can be part of the #100DaysToOffload but I currently don't know where to start. So what's left then to tell you, dear reader, is how this blog post is brought to you and thereby also include a few hints about what I will write during the next months!
/Note 2023-03-22: The post as I wrote it initially did not meet my criteria for a high-quality blog post. Therefore, I improved and expanded it while making sure the original meaning was kept./
So about that workflow. Let's start the same way that I work with it. Currently I'm running my [[/uses][older Lenovo Y50-70 laptop]] with Windows 10 since I like to do creative stuff like graphic design or editing photos and therefore rely on software that is not available on UNIX/Linux. However I'm mostly a Linux user and a few years back I fell in the large Emacs rabbit hole and can't get out. So for starting this post I open my Debian WSL2 instance in Windows Terminal and fire up that old editor with ~setsid emacs~. A few seconds later a white rectangle pops up on my screen (I have VcXsrv installed) and I can navigate to my =blog.org= file in my [[https://git.mmk2410.org/mmk2410/mmk2410.org][website repo]].
The [[https://100daystooffload.com/][#100DaysToOffload]] challenge starts very well. I'm sitting here at my desk with the to-do in front of me to write post number two. And I have absolutely no idea what to write! Well, there are some topics I want to cover on the blog during the next months and they can be part of the #100DaysToOffload challenge but I currently don't know where to start. So what's left then to tell you, dear reader, is how this blog post is brought to you and thereby also include a few hints about what I will write during the next months!
Once I'm there I create a new headline, set two properties: an export file name and an export date, add the #100DaysToOffload category and start writing (or at least I would if I knew what to write). Once that is done I need to manually run ~(require 'ox-hugo)~ since I'm quite lazy and never took the time to load this automatically using my [[https://git.mmk2410.org/mmk2410/dot-emacs][Emacs config]]. But what is =ox-hugo=? Well, =ox= is short for [[https://orgmode.org/][org]] export and [[https://gohugo.io/][hugo]] is a well-known static site generator. So =ox-hugo= lets me export my large =blog.org= file containing all my blog posts to files that =hugo= can understand. If I'm done writing I exported the new post, run =hugo serve= in the terminal, visit localhost:1313 in my browser and verify that the content and markup is to my liking. Once I'm satisfied I can upload the changes I made to my website using a [[https://git.mmk2410.org/mmk2410/mmk2410.org/src/branch/main/publish.sh][hacky script I wrote]] and spread the word on [[https://fosstodon.org/@mmk2410][Fosstodon]].
So about that workflow. Let's start the same way that I work with it. Currently, I'm sitting in front of my [[/uses][older Lenovo Y50-70 laptop]] running Windows 10 (I'm doing a lot of creative stuff like graphic design or editing photos and thereby rely on software that is sadly not available on UNIX/Linux). However, since I'm mostly a Linux user and fell into the large [[https://www.gnu.org/software/emacs/][Emacs]] rabbit hole a few years ago, I'm using the [[https://learn.microsoft.com/en-us/windows/wsl/][Windows Subsystem for Linux (WSL)]].
But there are somethings that I would like to optimize. Adjusting my Emacs configuration like written above is just one thing. Another is that it is currently quite cumbersome to create a new blog post. A template, e.g. using org-capture or similar is something I want to investigate in. And I really need to put some time in the publish script...
For starting a new post, I open my [[https://www.debian.org/][Debian]] WSL2 instance in Windows Terminal and fire up that old editor with ~setsid emacs~. The ~setsid~ command starts Emacs in a new session, i.e. it forks off and lets me use the shell for other stuff (or close it if I don't need it). A few seconds later a white rectangle pops up on my screen (I have [[https://sourceforge.net/projects/vcxsrv/][VcXsrv]] installed for displaying graphical applications running in WSL) and I can navigate to my =blog.org= file in my [[https://git.mmk2410.org/mmk2410/mmk2410.org][website repo]].
If you made it this far: Congratulations! You survived this quite technical overview and are ready to read more about my workflow in the future! If you just scrolled to the end: that's also fine. While I can't promise it, I don't think that all of the 98 blog posts that are left will be that technical. And if they are they will explain the stuff I write about.
The =blog.org= file is written in [[https://orgmode.org/][Org Mode]] (a more powerful Markdown equivalent) and contains all my blog posts. On top of the file, I create a new headline, set two properties: an export file name and an export date, add the #100DaysToOffload category (in Org Mode, categories start with an =@= char), and perhaps another tag or two. This results in a starting point like the following:
#+begin_src org
,* How this post is brought to you... :@100DaysToOffload:orgmode:hugo:
:PROPERTIES:
:EXPORT_DATE: [2022-01-12 Wed 18:23]
:EXPORT_FILE_NAME: 100dto-how-this-post-is-brought-to-you.md
:END:
#+end_src
And now I can start writing (or at least I could if I knew what to write). Once that's done, I reviewed the draft a few times. Normally, I read through it 1-2 times and also check the grammar using Grammarly. If possible, I also take a short break after writing the initial draft and before reading it to clear my head and get some distance.
Now it's time to publish the new post. To build an HTML page from the new entry in the =blog.org= file, I'm using [[https://ox-hugo.scripter.co/][ox-hugo]]. What's that? Well, =ox= is short for [[https://orgmode.org/][org]] export, and [[https://gohugo.io/][Hugo]] is a well-known static site generator. So =ox-hugo= lets me export the =blog.org= file to Hugo-compatible Markdown. Since I'm a bit lazy and never took the time to load the Emacs package automatically using my [[https://git.mmk2410.org/mmk2410/dot-emacs][Emacs configuration]], I need to manually run ~(require 'ox-hugo)~. To trigger the export of the new blog post, I'm using the keybinding =C-c C-e H H= (=C-= is the common Emacs notation for pressing the control key, so =C-C= means pressing the =c= key while holding the control key).
After exporting, I can now run =hugo serve= in the terminal for running a local version of my website with the new post locally. I can view it in my browser at the address =localhost:1313= and verify that the output is to my liking. Once I'm satisfied, I upload the changes I made to my website using a [[https://git.mmk2410.org/mmk2410/mmk2410.org/src/branch/main/publish.sh][hacky script I wrote]] that is based on [[https://rsync.samba.org/][rsync]] and spread the word of the new post on [[https://fosstodon.org/@mmk2410][Fosstodon]].
That sounds complicated to you? Well, I have the same opinion. That's why I would like to optimize some parts of this. Adjusting my Emacs configuration as written above is just one small thing. Another one is, that it is currently quite cumbersome to create a new blog post. A template, e.g. using org-capture, or similar, is something I want to investigate. And I need to put some time into the publish script.
If you made it through this whole post: Congratulations! You survived this quite technical overview and are ready to read more about my workflow in the future! If you just scrolled to the end: that's also fine. While I can't promise it, I don't think that all of the 98 blog posts that are left will be that technical. And if they are they will explain the stuff I write about.
/Day 2 of the [[https://100daystooffload.com/][#100DaysToOffload]] challenge./