summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ravi-init-org.el46
1 files changed, 46 insertions, 0 deletions
diff --git a/lisp/ravi-init-org.el b/lisp/ravi-init-org.el
index c4c3585..20039cd 100644
--- a/lisp/ravi-init-org.el
+++ b/lisp/ravi-init-org.el
@@ -154,5 +154,51 @@ background of code according to theme"
(when (fboundp 'ravi/setup-org-capture)
(ravi/setup-org-capture)))
+(use-package org-static-blog
+ :commands (org-static-blog-create-new-post org-static-blog-publish)
+ :config
+ (defun ravi/org-static-blog-data-file (blog-dir fname)
+ (with-temp-buffer
+ (insert-file-contents (expand-file-name (concat "data/" fname) blog-dir))
+ (buffer-string)))
+
+ (defun ravi/org-static-blog-setup (blog-name blog-domain blog-title)
+ (let ((blog-dir (expand-file-name (concat blog-name "." blog-domain "/") "~/Documents"))
+ (blog-url (concat "https://" blog-name "." blog-domain ".com")))
+ (setq org-static-blog-use-preview t
+ org-static-blog-preview-convert-titles t
+ org-static-blog-preview-ellipsis "..."
+ org-static-blog-enable-tags t
+ org-static-blog-publish-url (concat blog-url "/")
+ org-static-blog-publish-title blog-title
+ org-static-blog-posts-directory (expand-file-name "posts/" blog-dir)
+ org-static-blog-drafts-directory (expand-file-name "drafts/" blog-dir)
+ org-static-blog-publish-directory (expand-file-name "blog/" blog-dir))
+ (setq org-static-blog-page-header
+ (concat
+ "<meta name=\"author\" content=\"Ravi R Kiran\">"
+ "<meta name=\"referrer\" content=\"no-referrer\">"
+ "<link href= \"/static/style.css\" rel=\"stylesheet\"
+ type=\"text/css\" />"
+ "<link rel=\"icon\" href=\"static/favicon.ico\">")
+
+ org-static-blog-page-preamble
+ (ravi/org-static-blog-data-file blog-dir "preamble.html")
+ org-static-blog-page-postamble
+ (ravi/org-static-blog-data-file blog-dir "postamble.html"))))
+ (run-hooks 'ravi/org-static-blog-hook)
+
+ ;; Ensure that generated files are saved in a separate directory
+ ;; shared with published blog directory, i.e.,
+ ;; (expand-file "generated" org-static-blog-posts-directory)
+ ;; (expand-file "generated" org-static-blog-drafts-directory)
+ ;; are symlinks to
+ ;; (expand-file "generated" org-static-blog-publish-directory)
+ (defun ravi/org-static-blog-generated-files (&rest args)
+ (save-excursion
+ (beginning-of-line)
+ (insert "#+property: header-args:plantuml :output-dir generated/\n")))
+ (advice-add 'org-static-blog-create-new-post :after #'ravi/org-static-blog-generated-files))
+
(provide 'ravi-init-org)
;;; ravi-init-org.el ends here