;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
DenoteGeneral settings
(use-package denote
:init
(setq denote-directory "/Users/mph/org/notes")
:config
(setq denote-infer-keywords t)
(setq denote-sort-keywords t)
(setq denote-file-type 'org) ; Org is the default, set others here
(setq denote-prompts '(title keywords))
;; Pick dates, where relevant, with Org's advanced interface:
(setq denote-date-prompt-use-org-read-date t)
;; By default, we fontify backlinks in their bespoke buffer.
(setq denote-link-fontify-backlinks t))
(add-hook 'dired-mode-hook #'denote-dired-mode)
Denote publishing
Enable denote dblocks
(require 'denote-org-dblock)
Universal for all projects
Align org-html’s divs with SimpleCSS’s primary containers, pull in Fuse.js & SimpleCSS
(setq org-html-divs
'((preamble "header" "preamble")
(content "main" "content")
(postamble "footer" "postamble")))
(setq org-html-validation-link nil ;; Don't show validation link
org-html-head-include-scripts nil ;; Use our own scripts
org-html-head-include-default-style nil ;; Use our own styles
org-export-with-author nil
org-html-head "<link rel=\"stylesheet\" href=\"https://cdn.simplecss.org/simple.min.css\" />
<link rel=\"stylesheet\" href=\"/local.css\" />
<script src=\"https://cdn.jsdelivr.net/npm/fuse.js@6.6.2\"></script>")
Denote project specific
Set up specific params for the Denote publishing project:
(setq org-publish-project-alist
`(("denote"
:base-directory "~/org/notes"
:base-extension "org"
:publishing-directory "~/webnotes/"
:publishing-function org-html-publish-to-html
:recursive t
:auto-sitemap t
:with-tags t
:html-validation-link t
:section-numbers nil
:sitemap-sort-files anti-chronologically
:html-preamble "<nav><ul>
<li><a href=\"/\" class=\"home\">Home</a>
<li><a href=\"/sitemap.html\">All Notes</a>
</ul>
</nav>
"
:sitemap-format-entry (lambda (entry style project)
(let ((title (org-publish-find-title entry project))
(date (format-time-string "%Y-%m-%d" (org-publish-find-date entry project))))
(if (not (equal entry ""))
(format "[[file:%s][%s]] (%s)" entry title date)
""))))))
Automate the HTML generation and indexing
Add this as a post-save hook:
(defun mph/publish-and-update-index ()
"Publish our projects then update the fuse index."
(interactive)
(progn
(call-interactively 'org-publish-all)
(shell-command "python3 ~/bin/fuse-index.py /Users/mph/webnotes")))
Sample .dir-locals.el:
((nil . ((before-save-hook . org-update-all-dblocks)
(after-save-hook . mph/publish-and-update-index)
)))