aboutsummaryrefslogtreecommitdiffstats
path: root/publish.el
diff options
context:
space:
mode:
authorGravatar Tom Willemse2020-09-10 01:34:32 -0700
committerGravatar Tom Willemse2020-09-10 01:34:32 -0700
commit3c06769ea9851e63b14067533fcb4929fac56352 (patch)
treebb9694acba80eb0d505fac83e52da17f4295a92a /publish.el
parent8216f2dc8323ed332212f712156e2ef576603116 (diff)
downloadnew-ryuslash.org-3c06769ea9851e63b14067533fcb4929fac56352.tar.gz
new-ryuslash.org-3c06769ea9851e63b14067533fcb4929fac56352.zip
Restructure website, start writing
Diffstat (limited to 'publish.el')
-rw-r--r--publish.el95
1 files changed, 27 insertions, 68 deletions
diff --git a/publish.el b/publish.el
index 24e2bf3..675e25e 100644
--- a/publish.el
+++ b/publish.el
@@ -24,11 +24,11 @@
;;; Code:
-(require 'ox-publish)
-(require 'ox-rss)
-(require 'subr-x)
(require 'dockerfile-mode)
+(require 'ob-dot)
+(require 'ox-publish)
(require 'rainbow-delimiters)
+(require 'subr-x)
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
@@ -43,88 +43,47 @@
time
(if (= time 1) "" "s")))
-(defun publish-org-sitemap (title list)
- "Create a site map file. TITLE is used as the title, LIST is turned into a subtree."
- (concat "#+TITLE: " title "\n"
- "#+OPTIONS: toc:nil num:nil\n\n"
- ;; (message "Lets see here: %S" list)
- (org-list-to-subtree list)))
-
-(defun publish-org-sitemap-format-entry (entry style project)
- "Format ENTRY as a healine.
-STYLE is ignored and PROJECT is passed on directly to related functions."
- (unless (directory-name-p entry)
- (format "%s\n :PROPERTIES:\n :ID: %s\n :RSS_PERMALINK: %s\n :PUBDATE: %s\n :END:\n %s\n Published on: %s\n\n [[file:%s][Read More]] (%s)"
- (org-publish-find-title entry project)
- entry
- (concat (string-remove-suffix ".org" entry) ".html")
- (format-time-string
- (cdr org-time-stamp-formats)
- (org-publish-find-date entry project))
-
- (with-temp-buffer
- (insert-file-contents (concat (plist-get (cdr project) :base-directory) "/" entry))
- (goto-char (point-min))
- (let ((current-element (org-element-at-point)))
- (while (not (equal (org-element-type current-element) 'paragraph))
- (org-forward-element)
- (setq current-element (org-element-at-point)))
- (buffer-substring-no-properties
- (plist-get (cadr current-element) :contents-begin)
- (plist-get (cadr current-element) :contents-end))))
- (format-time-string
- (cdr org-time-stamp-formats)
- (org-publish-find-date entry project))
- entry
- (with-temp-buffer
- (insert-file-contents (concat (plist-get (cdr project) :base-directory) "/" entry))
- (publish-format-reading-time
- (publish-calculate-reading-time (current-buffer)))))))
-
-(setq org-rss-use-entry-url-as-guid t)
-
(setq org-export-exclude-tags '("noexport" "draft"))
+(setq org-confirm-babel-evaluate nil)
+
+(setq org-html-head-include-default-style t)
+
(setq org-html-htmlize-output-type 'css)
(setq org-publish-timestamp-directory
(concat default-directory "/.org-timestamps/"))
(setq org-publish-project-alist
- '(("posts"
- :base-directory "posts/"
+ '(("index"
+ :base-directory "."
:base-extension "org"
:publishing-directory "public/"
:recursive t
+ :exclude "^posts/"
:publishing-function org-html-publish-to-html
- :html-head "<link rel=\"stylesheet\" href=\"assets/css/main.css\" type=\"text/css\"/>"
+ :html-head "<link rel=\"stylesheet\" href=\"/assets/css/main.css\" type=\"text/css\"/>")
+ ("posts"
+ :base-directory "posts/"
+ :base-extension "org"
+ :publishing-directory "public/posts/"
+ :recursive t
+ :publishing-function org-html-publish-to-html
+ :html-head "<link rel=\"stylesheet\" href=\"/assets/css/main.css\" type=\"text/css\"/>"
:html-preamble (lambda (project)
(let ((buffer (find-file-noselect (buffer-file-name))))
(unless (string= "ryuslash.org"
(car (org-publish-find-property (buffer-file-name) :title project)))
(publish-format-reading-time
- (publish-calculate-reading-time buffer)))))
- :auto-sitemap t
- :sitemap-filename "index.org"
- :sitemap-title "ryuslash.org"
- :sitemap-format-entry publish-org-sitemap-format-entry
- :sitemap-style list
- :sitemap-function publish-org-sitemap
- :sitemap-sort-files anti-chronologically)
- ("rss"
- :base-directory "posts/"
- :base-extension "org"
- :html-link-home "https://ryuslash.org/"
- :rss-link-home "https://ryuslash.org/"
- :html-link-use-abs-url t
- :rss-extension "xml"
- :publishing-directory "public"
- :publishing-function (org-rss-publish-to-rss)
- :section-number nil
- :exclude ".*"
- :include ("index.org")
- :table-of-contents nil)
- ("all" :components ("posts" "rss"))))
+ (publish-calculate-reading-time buffer))))))
+ ("assets"
+ :base-directory "."
+ :recursive t
+ :exclude "^public/"
+ :base-extension "svg"
+ :publishing-function org-publish-attachment
+ :publishing-directory "public/")
+ ("all" :components ("index" "posts" "assets"))))
(provide 'publish)
;;; publish.el ends here