Add Atom feed from my source control system to each page

This commit is contained in:
Tom Willemse 2020-11-21 10:17:11 -08:00
parent c8856eb797
commit 88de93b360

View file

@ -30,6 +30,12 @@
(require 'rainbow-delimiters)
(require 'subr-x)
(defconst publish-root
(file-name-directory
(or load-file-name
(buffer-file-name)))
"The directory where oni-org was loaded from.")
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
(defun publish-calculate-reading-time (buffer)
@ -89,5 +95,21 @@
:publishing-directory "public/")
("all" :components ("index" "posts" "assets"))))
(defvar publish-feed-url-format
;"https://gitlab.com/ryuslash/ryuslash.org/-/commits/master/%s?feed_token=Rf8otgpS8YEiYakJN4NR&format=atom"
"https://code.ryuslash.org/new-ryuslash.org/atom/%s?h=master"
"Format string for the URL to the pages atom feed.")
(add-hook 'org-export-before-processing-hook
(lambda (backend)
(when (eq backend 'html)
(let ((file-name (if (string= (buffer-file-name)
(expand-file-name "index.org"))
""
(file-relative-name (buffer-file-name) publish-root))))
(insert "#+HTML_HEAD: <link rel=\"alternate\" type=\"application/atom+xml\" href=\""
(format publish-feed-url-format file-name)
"\" title=\"Atom Feed\"/>\n")))))
(provide 'publish)
;;; publish.el ends here