Config: fix ox-hugo path

This commit is contained in:
User
2026-04-09 18:07:51 +08:00
parent c3c59376f0
commit 8e9ba476f8
3 changed files with 33 additions and 13 deletions

View File

@@ -8,7 +8,13 @@
'(ace-window benchmark-init cape cnfonts corfu crux drag-stuff eglot embark-consult everything '(ace-window benchmark-init cape cnfonts corfu crux drag-stuff eglot embark-consult everything
exec-path-form-shell gcmh hungry-delete marginalia multiple-cursors orderless exec-path-form-shell gcmh hungry-delete marginalia multiple-cursors orderless
restart-emacs smart-mode-line solarized-theme vertico)) restart-emacs smart-mode-line solarized-theme vertico))
'(safe-local-variable-values '((org-use-tag-inheritance))) '(safe-local-variable-values
'((eval progn
(setq org-hugo-base-dir
(if (eq system-type 'windows-nt) "h:/emacs/hugo/this-is-my-blog/"
"~/org/hugo/this-is-my-blog/"))
(org-hugo-auto-export-mode))
(org-use-tag-inheritance)))
'(warning-suppress-log-types '((initialization)))) '(warning-suppress-log-types '((initialization))))
(custom-set-faces (custom-set-faces
;; custom-set-faces was added by Custom. ;; custom-set-faces was added by Custom.

View File

@@ -18,6 +18,7 @@
(require 'init-elpa) (require 'init-elpa)
(require 'init-package) (require 'init-package)
(require 'init-org) (require 'init-org)
(require 'init-org-refile)
(require 'init-completion) (require 'init-completion)
(require 'init-window) (require 'init-window)
(require 'init-dired) (require 'init-dired)

View File

@@ -305,22 +305,33 @@ See `org-capture-templates' for more information."
":END:" ":END:"
"\n\n") ;Place the cursor here finally "\n\n") ;Place the cursor here finally
"\n"))) "\n")))
(if *is-windows*
(add-to-list 'org-capture-templates (add-to-list 'org-capture-templates
'("h" ;`org-capture' binding + h '("h" ;`org-capture' binding + h
"Hugo post" "Hugo post"
entry entry
;; It is assumed that below file is present in `org-directory' ;; It is assumed that below file is present in `org-directory'
;; and that it has a "Blog Ideas" heading. It can even be a ;; and that it has a "Blog Ideas" heading. It can even be a
;; symlink pointing to the actual location of all-posts.org! ;; symlink pointing to the actual location of all-posts.org!
(file+headline "h:/emacs/hugo/this-is-my-blog/all-blog.org" "Blog Ideas") (file+headline "h:/emacs/hugo/this-is-my-blog/all-blog.org" "Blog Ideas")
(function org-hugo-new-subtree-post-capture-template)))) (function org-hugo-new-subtree-post-capture-template)))
(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 "~/org/hugo/this-is-my-blog/all-blog.org" "Blog Ideas")
(function org-hugo-new-subtree-post-capture-template)))))
;; 快速部署 ;; 快速部署
(defun my-blog-publish () (defun my-blog-publish ()
"Publish blog , git add/commit/push , generate commit message." "Publish blog , git add/commit/push , generate commit message."
(interactive) (interactive)
(let* ((blog-dir "h:/emacs/hugo/this-is-my-blog/") (let* ((blog-dir (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")) (timestamp (format-time-string "%Y-%m-%d %H:%M:%S"))
(default-directory blog-dir)) (default-directory blog-dir))
@@ -349,7 +360,9 @@ See `org-capture-templates' for more information."
"Save and preview blog." "Save and preview blog."
(interactive) (interactive)
(save-buffer) (save-buffer)
(let ((default-directory "h:/emacs/hugo/this-is-my-blog/")) (let ((default-directory (if *is-windows*
"h:/emacs/hugo/this-is-my-blog/"
"~/org/hugo/this-is-my-blog/")))
;; 启动 Hugo server ;; 启动 Hugo server
(start-process "hugo-server" "*hugo-server*" (start-process "hugo-server" "*hugo-server*"
"hugo" "server" "-D" "--bind" "0.0.0.0" "--port" "1313") "hugo" "server" "-D" "--bind" "0.0.0.0" "--port" "1313")