website/code/blog.el

23 lines
960 B
EmacsLisp
Raw Normal View History

2024-04-25 04:08:07 +00:00
;; code for the simple (but powerful) automation of posts creation
;; requires ox-hugo
(defvar blog-org-files-directory "/mnt/Data/Documents/org-files/org/blog/")
;; where the posts will be converted
(setq org-hugo-base-dir "/mnt/Data/watashinoblog/")
(defun generate-blog-file-path ()
(concat blog-org-files-directory "/"
(format-time-string "%Y-%m-%d-%H-%M-%S") ".org"))
(setq org-capture-templates
`(("b" "Blog Post" entry
(file ,(lambda () (generate-blog-file-path))) ; Target file path generation
"* %?\n#+EXPORT_HUGO_DRAFT: true\n#+EXPORT_HUGO_SECTION_FRAG: \n#+TITLE: %^{Title}\n#+DATE: %U\n#+AUTHOR: Hashirama\n#+FILETAGS: %^{Tags}\n#+UPDATED: %U\n#+CREATED: %<%Y-%m-%d %a %H:%M>\n"
:empty-lines 1 ; Ensure an empty line after the captured content
:prepend t ; Insert content at the beginning of the file
:jump-to-captured t))) ; Jump to the captured position after capture