From bc845e75244d32c82bea79655230c59814c7aba3 Mon Sep 17 00:00:00 2001 From: Peter Tillemans Date: Fri, 16 Aug 2024 00:43:50 +0200 Subject: [PATCH] better support for zola blogging --- init.org | 49 +++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/init.org b/init.org index 0fdeef7..c78ec53 100644 --- a/init.org +++ b/init.org @@ -1048,22 +1048,32 @@ it in the same context. Hmmm.... sounds even better. (class (append mlx-latex-classes snm-latex-classes)) (add-to-list 'org-latex-classes class))) #+END_SRC -*** Org Blogging +**** Blogging with Zola + +gicrisf has [[https://github.com/gicrisf/ox-zola][created a package]] to export org files to Zola. + #+BEGIN_SRC emacs-lisp - - - ;; I started blogging again. To stimulate this let's add a template to get started - ;; on a new post. - (defvar snamellit/blog-title "test-title") - (defun snamellit/capture-blog-post-file () - "Create a new blog post file with a title and date." - (let* ((title (read-from-minibuffer "Post Title: ")) - (slug (replace-regexp-in-string "[^a-z0-9]+" "-" (downcase title)))) - (setq snamellit/blog-title title) - (format "~/src/website/content/blog/%s-%s.md" - (format-time-string "%Y-%m-%d" (current-time)) - slug))) + (use-package ox-hugo + :ensure t + :pin melpa + :after ox) + (use-package ox-zola + :ensure (ox-zola :host github :repo "gicrisf/ox-zola" :files (:defaults "*.el" "backend" "stylesheets")) + :after ox-hugo + :config + (require 'ox-hugo) + :general + (" o z" 'ox-zola-export-wim-to-md)) #+END_SRC + +#+RESULTS: +: [nil 26301 59789 776924 nil elpaca-process-queues nil nil 824000 nil] + +It is a wrapper around ~ox-hugo~ to export org files to Zola. It +supports most features of it and directs the user to the [[https://ox-hugo.scripter.co/][the hugo +exporter manual.]] + + *** Org Capture Customization #+BEGIN_SRC emacs-lisp (use-package org-capture @@ -1080,9 +1090,9 @@ it in the same context. Hmmm.... sounds even better. '("j" "Journal" entry (file+datetree +org-capture-journal-file) "* %?\nEntered on %U\n %i\n %a")) (add-to-list 'org-capture-templates - '("b" "Blog Post" plain - (file snamellit/capture-blog-post-file) - "+++\ntitle = %(progn snamellit/blog-title)\ndate = %t\nauthor = Peter Tillemans\nemail = pti@snamellit.com\n[taxonomies]\ntags = []\ncategories = []\n+++\n\n%?")) + '("b" "Blog Post" entry + (file+headline "~/org/snamellit/blog.org" "Blog Posts") + "** %^{Blog Title:}\n:PROPERTIES:\n:EXPORT_FILE_NAME %^{Export Filename:}\n:EXPORT_DATE: %t\n:END:\n%i%?")) ;; configure support for recipes (add-to-list 'org-capture-templates @@ -2190,7 +2200,10 @@ notably it integrates with *use-package* to define keybindings which will load the package if not loaded yet. It considerably streamlines managing evil bindings so it should offer enough value but I just removed it, so it'll have to wait a bit. -** TODO Add support for zola blogposts writing in org-mode +** NEXT Add support for zola blogposts writing in org-mode +:LOGBOOK: +CLOCK: [2024-08-15 Thu 13:47] +:END: see [[https://github.com/gicrisf/ox-zola][ox-zola]] for exporting org-mode to zola markdown. * Final Words