There are examples of doing this already, namely here and here but neither is to my taste in engaging with emacs and org-mode. Namely, there is a charm to just write in markdown after dumping a template to the org-file used for my blog setup and posts.
Why? The whole blog is the one org file. One run of
(c25l-hugo-setup) builds every file that a blank blog would need (provided you tangle out your config.toml, whatever templates, and whatever else you need.) After that, just running
(org-babel-tangle) again will refresh everything to the newest changes as reflected in this single source file.
(defun c25l-hugo-post (title) (interactive "sTitle: ") (org-insert-heading) (insert title) (insert (concat "\n" "#+begin_src html :tangle /tmp/blog/content/post/" (replace-regexp-in-string " " "_" title) ".md\n" "+++\n" "categories = \n" "title = \"" title "\"\n" "date = \"" (format-time-string "%Y-%m-%dT%H:%M:%S" (org-current-time)) "-05:00\"\n" "+++\n" "\n\n\n\n" "#+end_src"))) (defun c25l-hugo-setup () ;;run me in the org file for your blog! (interactive) (shell-command "rm -rf /tmp/blog; mkdir -p /tmp/blog/content/post /tmp/blog/themes /tmp/blog/layouts/partials/ /tmp/blog/static/") (shell-command "git clone **whatever you like**/tmp/blog/themes/theme") (org-babel-tangle))
原文时间: 2016-04-22 10:04
整理时间: 2016-04-24 23:13
本文由 Hick 整理，转载请保留以上信息;
The articles on this site come from Internet, thanks to all the original authors.
If anything about COPYRIGHT, or LEFT, please contact Emacsist at gmail dot com .