diff --git a/content/daily/2024-06-17.md b/content/daily/2024-06-17.md new file mode 100644 index 0000000..d76bda2 --- /dev/null +++ b/content/daily/2024-06-17.md @@ -0,0 +1,38 @@ ++++ +title = 2024-06-17 +author = ["SouthFox"] +date = 2024-06-17T23:26:00+08:00 +lastmod = 2024-06-17T23:37:51+08:00 +tags = ["publish"] +draft = false ++++ + +## org-roam 自动发布 {#org-roam-自动发布} + +[论 Emacs 的易折腾性]({{< relref "../main/论_emacs_的易折腾性.md" >}}) + +懒是进步的动力,在运行发布命令又切到对应的仓库有运行 `commit` && `push` 几十次后终于是觉得有点 +烦了,所以加装改造了下之前的[来把 org-roam 笔记发布出去吧]({{< relref "../articles/来把 org-roam 笔记发布出去吧.md" >}})里的发布命令,简单拼接了下调用 +`shell-command` 来自动进行 `git` 操作。 + +其中 `org-roam-update-org-id-locations` 是因为实际笔记中是 `UUID` 格式,在被 `ox-hugo` 发布时需要让 +`org-mode` 知道对应的路径,否则会在进行发布时报未知链接错误,这个链接就在发布时自动执行这项操作。 + +```emacs-lisp +(defun my/org-roam-publish () + "Publish current file" + (interactive) + (org-roam-update-org-id-locations) + (org-roam-set-keyword "filetags" ":publish:") + (save-buffer) + (org-hugo-export-wim-to-md) + (shell-command (concat "cd " org-hugo-base-dir + " && " "git add ." + " && " "git commit -m '[post] new post'" + " && " "git push")) + (message "publish nwe post!")) +``` + +```text +my/org-roam-publish +```