diff options
-rw-r--r-- | publish.el | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -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 page’s 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 |