Skip to content

Commit d8e520e

Browse files
committed
Add Hugo status post create function and key
1 parent cd3265e commit d8e520e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

init.el

+11
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,17 @@
200200
(setq hugo-default-server-flags '(drafts future))
201201
(setq hugo-create-post-bundles t)
202202
(global-set-key (kbd "C-c h s") 'hugo-status)
203+
(define-key hugo-mode-map (kbd "C") 'air-hugo-maybe-create-status-post)
204+
(defun air-hugo-maybe-create-status-post ()
205+
"If we're in the \=status\= blog, create a new status post."
206+
(interactive)
207+
(let* ((project (car (last
208+
(cl-remove-if
209+
(lambda (i) (string= i ""))
210+
(file-name-split (hugo--get-root)))))))
211+
(if (string= project "status")
212+
(hugo--create-content "posts" (format-time-string "%Y-%m-%d %H:%M"))
213+
(error "Status posts must be created in the status blog"))))
203214

204215
(require 'periodic-commit-minor-mode)
205216

0 commit comments

Comments
 (0)