diff options
| author | Craig Jennings <c@cjennings.net> | 2026-02-13 23:29:21 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-02-13 23:29:21 -0600 |
| commit | 2f286a0d1c49ea30c2e36027aac859899547aa9d (patch) | |
| tree | 82512fae2b16005ac01c95f6b38c17d337645c38 | |
| parent | fbed3c6b6a763b159d9fed88183e506e3c032b59 (diff) | |
| download | dotemacs-2f286a0d1c49ea30c2e36027aac859899547aa9d.tar.gz dotemacs-2f286a0d1c49ea30c2e36027aac859899547aa9d.zip | |
feat(export): add ox-hugo config with capture template
Enable ox-hugo for Hugo blog workflow. Adds C-c c h capture template
for quick post creation with auto-generated slug and date.
| -rw-r--r-- | modules/org-export-config.el | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/modules/org-export-config.el b/modules/org-export-config.el index 612b80cb..2e921174 100644 --- a/modules/org-export-config.el +++ b/modules/org-export-config.el @@ -144,9 +144,35 @@ (?d "to docx and open" org-pandoc-export-to-docx-and-open) (?z "to pdf and open (Zathura)" my/org-pandoc-export-to-pdf-and-open)))) -;; hugo markdown -;; (use-package ox-hugo -;; :after ox) +;; ---------------------------------- ox-hugo ---------------------------------- +;; Export Org subtrees to Hugo-compatible Markdown. +;; Each Org heading with :EXPORT_FILE_NAME: becomes a separate Hugo post. +;; Source file: ~/projects/website/content-org/log.org + +(use-package ox-hugo + :after ox + :config + (defvar org-capture-templates) + + (defun cj/org-hugo-new-post-capture-template () + "Return a new Hugo post subtree template for org-capture. +Prompts for title, generates slug, and sets export date to today." + (let* ((title (read-from-minibuffer "Post Title: ")) + (fname (org-hugo-slug title))) + (mapconcat #'identity + `(,(concat "* TODO " title) + ":PROPERTIES:" + ,(concat ":EXPORT_FILE_NAME: " fname) + ,(concat ":EXPORT_DATE: " + (format-time-string "%Y-%m-%d")) + ":END:" + "%?\n") + "\n"))) + + (add-to-list 'org-capture-templates + '("h" "Hugo post" entry + (file "~/projects/website/content-org/log.org") + (function cj/org-hugo-new-post-capture-template)))) ;; github flavored markdown ;; (use-package ox-gfm |
