Posts
-Table of Contents
Disclaimer
-Disclaimer
+I'm neither proficient in Org Mode (further on "Org"), nor a good front-end engineer. I think that a simple solution is better than no solution. If you see a mistake, you can contact me via iam@fidonode.me.
What is Org?
-What is Org?
+Your life in plain text @@ -56,9 +55,9 @@ Everything you can do in Org is to write a text. With a special markup, of cours
Why Org Mode?
-Why Org Mode?
+- Plain text. Plain text as a data source offers significant versatility. You can read and understand what happens in org files without needing Emacs. @@ -70,16 +69,16 @@ I do not have a habit of collecting and keeping information. I believe that disc
Render Org to blog or whatever
-Render Org to blog or whatever
+Org already has a way to render files into HTML, allowing you to create simple HTML files with minimal styling. I'm not interesting in styling from org, so I decide to use picocss framework.
Render HTML
-Render HTML
+
I want to change some templates here and there. I've found esxml
package. It is a decent DSL for writing XML/HTML.
Here is how page header and footer look in this DSL.
@@ -192,9 +191,9 @@ So everything is almost done. Time to use our custom publishing function in proj
Static files
-Static files
+Yep, you may want to publish some photos with your blog or any other static files.
@@ -215,9 +214,9 @@ Looks self explanatory.Whole build script
-Whole build script
+
Here is the whole elisp script which I use to publish my blog. It have some additional quirks to work with doomscript ./build-site.el
.
Publish through GitHub Action
-Publish through GitHub Action
+
With all previous preparations, this step sounds simple like: emacs -Q --script ./build-site.el
I've chosen a pretty standard way to publish static sites through GitHub Pages. Since I keep my Org files in a private repo, I need some additional steps to address it. I use the peaceiris/actions-gh-pages@v3
action to publish from my Org repo to the Pages repo.
@@ -387,9 +386,9 @@ However, since I use Doom Emacs
as my configuration framework, we n
Install Emacs
-Install Emacs
+
If you want to run Emacs Lisp
, you need the whole Emacs, at least without GUI. In a GitHub Action, you can simply run:
Just bring everything
-Just bring everything
+I need to take extra steps since I use Doom Emacs and have my configs in Org. You may also need to install dependencies for your configuration.
@@ -448,9 +447,9 @@ Of course, I use a caching step to make the whole process faster:BTW I use GNU Emacs
-BTW I use GNU Emacs
+Here's the whole publishing workflow.
@@ -531,40 +530,27 @@ jobs:What is next
-What is next
+I have a plans to make posts about next features:
RSS
-RSS Feed
+Open Graph
+Already implemented. Need to document process.
Open Graph
--Already implemented. Need to document process. -
-Sitemap
--Not implemented yet. -
-Code highlighting
-Code highlighting
+Only rudimentary highlight. Want something fancier.
diff --git a/posts/add_rss_to_blog.html b/posts/add_rss_to_blog.html new file mode 100644 index 0000000..33cfdc2 --- /dev/null +++ b/posts/add_rss_to_blog.html @@ -0,0 +1,142 @@ +Table of Contents
+ +Why do you even need RSS?
++RSS might seem like an outdated, marginal thing. But it still has at least one benefit—you can use an RSS feed as a sitemap for search engines. Plus, it's pretty geeky. +
+Add RSS feed
++So, what's happening here? Let's start by integrating our templating functions into the build. +
+Use sitemap backend in the build
+(setq org-publish-project-alist + (list + (list "blog-rss" + :author "Alex M" + :email "iam@fidonode.me" + :base-directory my/blog-src-path + :base-extension "org" + :recursive t + :exclude (regexp-opt '("rss.org" "index.org" "404.org" "posts.org")) + :publishing-function 'my/publish-to-rss + :publishing-directory my/web-export-path + :rss-extension "xml" + :html-link-home my/url + :html-link-use-abs-url t + :html-link-org-files-as-html t + :auto-sitemap t + :sitemap-filename "rss.org" + :sitemap-title "rss" + :sitemap-style 'list + :sitemap-sort-files 'anti-chronologically + :sitemap-function 'my/format-rss-feed + :sitemap-format-entry 'my/format-rss-feed-entry) + )) ++
+How does it work? As you can see, we use the default sitemap generator from Org Export with some additional steps. By default, the sitemap generator collects all org files from :base-directory
. It then places links to these files as separate entries into an intermediate org file and publishes this org file. We use custom functions for collecting entries, formatting entries, and publishing the org file.
+
Publishing and formatting functions
++We need a mandatory dependency because we don't want to mess with forming correct XML by ourselves. +
+(require 'ox-rss) ++
+Here's the core of the process. We need to prepare entries before feeding them to the org-rss-publish-to-rss
function. Since we're doing it our own way, we need to start by creating a bullet with a link to the post, and then add RSS_PERMALINK
, RSS_TITLE
, and PUBDATE
. I also add the first two lines of the blog post instead of a description. This is the native way to do a preview in the RSS world.
+
(defun my/format-rss-feed-entry (entry style project) + "Format ENTRY for the RSS feed. +ENTRY is a file name. STYLE is either 'list' or 'tree'. +PROJECT is the current project." + (cond ((not (directory-name-p entry)) + (let* ((file (org-publish--expand-file-name entry project)) + (title (org-publish-find-title entry project)) + (date (format-time-string "%Y-%m-%d" (org-publish-find-date entry project))) + (link (concat (file-name-sans-extension entry) ".html"))) + (with-temp-buffer + (org-mode) + (insert (format "* [[file:%s][%s]]\n" file title)) + (org-set-property "RSS_PERMALINK" link) + (org-set-property "RSS_TITLE" title) + (org-set-property "PUBDATE" date) + (let ((first-two-lines (with-temp-buffer + (insert-file-contents file) + (buffer-substring-no-properties + (point-min) + (progn (forward-line 2) (point)))))) + (if (string-suffix-p "\n" first-two-lines) + (setq first-two-lines (substring first-two-lines 0 -1))) + (insert first-two-lines)) + (goto-char (point-max)) + (insert "...") + (buffer-string)))) + ((eq style 'tree) + ;; Return only last subdir. + (file-name-nondirectory (directory-file-name entry))) + (t entry))) + ++
+This function creates the content of the intermediate org file. Mostly a rudimentary title, and then we ask Org to unwind the list of collected files with the my/format-rss-feed-entry
function.
+
(defun my/format-rss-feed (title list) + "Generate RSS feed, as a string. +TITLE is the title of the RSS feed. LIST is an internal +representation for the files to include, as returned by +`org-list-to-lisp'. PROJECT is the current project." + (concat "#+TITLE: " title "\n" + "#+STARTUP: showall \n\n" + (org-list-to-subtree list 1 '(:icount "" :istart "")))) ++
+This function replaces the default publishing function to filter everything except the intermediate file before publishing. +
+(defun my/publish-to-rss (plist filename pub-dir) + "Publish RSS with PLIST, only when FILENAME is 'rss.org'. +PUB-DIR is when the output will be placed." + (if (equal "rss.org" (file-name-nondirectory filename)) + (org-rss-publish-to-rss plist filename pub-dir))) ++
+Voila! Now you have an rss.xml
in your export path.
+
Table of Contents
My end-game (at least I hope) keyboard
-My end-game (at least I hope) keyboard
+Keebs path
-Keebs path
+Sometimes I think about the long journey I've made with keebs. In childhood, I had decent membrane keyboards, most of which had an ergonomic profile like the MS. Not sure if it somehow affected my taste because I started my career with the simplest, cheapest board and typed countless lines of code on such keebs. Then I heard about clickity-clack mechanical keyboards and decided to try one. It was a simple Chinese keeb with a thick metal body, double-shot caps, and Cherry Brown switches. A decent thing to annoy everyone around you. I think this purchase marked my dive into mech keebs I'm not a geeky aficionado who thinks you can fix everything with a new keyboard, but I built a couple of them. I hope I've finally built the last one for quite some time.
Dactyl manuform
-Dactyl manuform
+Almost all of the time, I struggle with my maximalism. So I decided to build the ultimate mechanical ergonomic split keyboard and chose the Dactyl Manuform. Sounds like a crazy idea. Zero experience with QMK, zero experience with hand-wired keyboards, and zero experience in 3D printing. The last problem was the easiest one; I just asked my friend to print the bodies from PETG polymer, and Bob's your uncle. I got two pieces of rough-layered plastic with all the support structures. God, it was a nightmare to clean these prints from supports and small artifacts, but I was happy. @@ -92,9 +92,9 @@ To be honest, this keeb was ugly, and I decided that I wanted a beautiful factor
Moonlander
-Moonlander
+Nothing special. Ordered, paid, got it, tried it. Everything worked. Looked good. Happy year of typing. Bored. Annoyed. Too big and chunky. No concave. Quality not the best. Started planning the next one.
@@ -107,9 +107,9 @@ Nothing special. Ordered, paid, got it, tried it. Everything worked. Looked goodCustom Corne
-Custom Corne
+This journey started with discovering the Jian keyboard. It is a niche keeb from the Ru community focused on full support of the whole Russian layout. It was originally created by KGOH. I missed the group buy and decided that I could easily patch a Corne board with two additional keys to mimic the Jian. Interesting journey. I learned how to use KiCad, and how to export gerbers. @@ -158,9 +158,9 @@ Daily driver for ~6 months. Then the world changed, and I decided to leave my ho
Dactyl manuform again
-Dactyl manuform again
+Two years late I've settled down in new country and decide that I want to bring back my dactyl manuform experience.
@@ -174,13 +174,13 @@ Two years late I've settled down in new country and decide that I want to bringHardware
-Hardware
+Body
-Body
+
I've choose to use a Ryan's generator and generate body on top of Corne preset with all keys in last row and disabled stagger for the last two columns. Generator preset
The body was printed by JLC3DP (JLCPCB printing department). I've choose SLS from nylon. Print has minor artifacts; I expected better quality.
@@ -216,9 +216,9 @@ Overall, I'm happy with results. I also printed bottom plates and
-
I've chosen Kailh BOX Navy switches. I really like the clickity-clack sound. They have a dedicated clickbar to produce this sound, and the box profile helps with moving down perpendicularly.
I used a bootleg Pro Micro called Tenstar Robot, based on the ATmega32u4. It's perfectly supported by QMK, pin-to-pin and size-compatible with the Pro Micro.
During this build, I decided that I did not want to make a big mess of wires and chose Amoeba single-switch PCBs.
Prerequiremets:
QMK CLI
@@ -313,9 +313,9 @@ You may want to create a separate keyboard entry in QMK.
I'll try to go through setting of my personal layout. It is based on Jian layout.
Switches and caps
-Switches and caps
+Controllers
-Controllers
+Amoeba things
-Amoeba things
+Software
-Software
+Plain default - QMK
-Plain default - QMK
+Make own layout
-Make own layout
+Whats next?
+Whats next?
Table of Contents
Org to HTML and back
-My keyboard journey
-Org to HTML and back
+