commit 94715328e2679ac1fd97f3af008ed12ca81e30fc
parent 63e1406383407d7908dda9c764a392b3d6028bc8
Author: andsy10 <andsy1016@gmail.com>
Date: Fri, 31 Jul 2026 11:12:07 +0800
Replace ox-hugo with ox-publish
Diffstat:
3 files changed, 13 insertions(+), 53 deletions(-)
diff --git a/lisp/init-kbd-func.el b/lisp/init-kbd-func.el
@@ -151,15 +151,10 @@ otherwise toggle global-jinx-mode."
(interactive)
(align-regexp (region-beginning) (region-end) "\\(\\s-*\\)::" 1 1 nil))
-(defun my-blog-publish (&optional directory)
- "Publish blog , git add/commit/push , generate commit message."
- (interactive)
- (let* ((blog-dir (or directory
- (if *is-windows*
- "h:/emacs/hugo/this-is-my-blog/"
- "~/org/hugo/this-is-my-blog/")))
- (timestamp (format-time-string "%Y-%m-%d %H:%M:%S"))
- (default-directory blog-dir))
+(defun my-push-with-timestamp (directory)
+ "Git add/commit/push, generate commit message."
+ (let ((timestamp (format-time-string "%Y-%m-%d %H:%M:%S"))
+ (default-directory directory))
(message "Adding files...")
(eshell-command "git add .")
(message "Committing: %s" timestamp)
@@ -170,22 +165,15 @@ otherwise toggle global-jinx-mode."
(message "Push may have failed or nothing to push, check *Messages* buffer for details")
(message "Push successfully %s" timestamp)))))
-(defun my-blog-preview ()
- "Save and preview blog."
+(defun my-note-push ()
+ "Git add/commit/push in `~/org/my-org-note/'."
(interactive)
- (save-buffer)
- (let ((default-directory (if *is-windows*
- "h:/emacs/hugo/this-is-my-blog/"
- "~/org/hugo/this-is-my-blog/")))
- (start-process "hugo-server" "*hugo-server*"
- "hugo" "server" "-D" "--bind" "0.0.0.0" "--port" "1313")
- (sleep-for 2)
- (browse-url "http://localhost:1313")))
+ (my-push-with-timestamp "~/org/my-org-note/"))
-(defun my-note-push ()
- "Git add/commit/push notes in `~/org/my-org-note/', generate commit message."
+(defun my-org-publish ()
+ "Git add/commit/push in `~/org/blog/posts/'."
(interactive)
- (my-blog-publish "~/org/my-org-note/"))
+ (my-push-with-timestamp "~/org/blog/posts/"))
(defun my-org-tree-slide-start ()
"Start `org-tree-slide'."
diff --git a/lisp/init-org.el b/lisp/init-org.el
@@ -222,36 +222,6 @@
(file+headline ,my-org-capture-file "Something to know")
"* IDKY %<%m-%d> %?\n%T" :empty-lines 1))))
-;; hugo
-(use-package ox-hugo
- :init
- (with-eval-after-load 'org-capture
- (defun org-hugo-new-subtree-post-capture-template ()
- "Returns `org-capture' template string for new Hugo post.
-See `org-capture-templates' for more information."
- (let* ((title (read-from-minibuffer "Post Title: ")) ;Prompt to enter the post title
- (fname (org-hugo-slug title)))
- (mapconcat #'identity
- `(
- ,(concat "* TODO " title)
- ":PROPERTIES:"
- ,(concat ":EXPORT_FILE_NAME: " fname)
- ":END:"
- "\n\n") ;Place the cursor here finally
- "\n")))
- (add-to-list 'org-capture-templates
- `("h" ;`org-capture' binding + h
- "Hugo post"
- entry
- ;; It is assumed that below file is present in `org-directory'
- ;; and that it has a "Blog Ideas" heading. It can even be a
- ;; symlink pointing to the actual location of all-posts.org!
- (file+headline ,(if *is-windows*
- "h:/emacs/hugo/this-is-my-blog/all-blog.org"
- "~/org/hugo/this-is-my-blog/all-blog.org")
- "Blog Ideas")
- (function org-hugo-new-subtree-post-capture-template)))))
-
;; presentation
(use-package org-tree-slide)
diff --git a/lisp/init-prog.el b/lisp/init-prog.el
@@ -73,7 +73,9 @@
(setq shr-inhibit-images nil
shr-use-fonts nil))
-(use-package htmlize)
+(use-package htmlize
+ :config
+ (setq org-html-htmlize-output-type 'css))
;; caddy
(use-package caddyfile-mode