A simple, customizable org publish demo
- Access a file, for example
./src/index.org
. - Use ~, e e P p~ to publish the project. The output will be in the
public
folder.
If you’re facing problems with publishing, do the following to do a clean publish.
- Run
rm ./public/
to clear the published directory. - Run
rm -rf ~/.emacs.d/.cache/.org-timestamps/
to clear the org cache.
To create a new post in the folder src/posts/year/month/date/post-name.org
, use the following function after replacing /path/to/project
with the actual path to your project.
(defun new-post ()
;; prompt for post name
;; replace spaces with dashes
;; prepend today's date
;; add .org
;; open file buffer
(interactive
(let* ((name (read-string "Post name: " nil 'my-history))
(posts-dir "~/path/to/project/")
(date (format-time-string "%Y/%m/%d")))
(find-file (concat posts-dir (downcase (format "%s/%s.org" date (replace-regexp-in-string " +" "-" name)))))
(insert "#+INCLUDE: \"../../../../options/default-config.org\"\n")
(insert (format "#+SUBTITLE: %s\n\n" name))
(org-mode)
)))