aboutsummaryrefslogtreecommitdiff
path: root/publish.el
diff options
context:
space:
mode:
authorYuchen Pei <me@ypei.me>2021-06-18 17:47:12 +1000
committerYuchen Pei <me@ypei.me>2021-06-18 17:47:12 +1000
commite9795c6b134eed858ddb73c036ff5c941d7e9838 (patch)
tree8749a5460dc81658b6016f8d08c0a129e60cef0e /publish.el
parent0663174364fef45d3985019b4f98375b4195bb0f (diff)
Updated.
Diffstat (limited to 'publish.el')
-rw-r--r--publish.el53
1 files changed, 33 insertions, 20 deletions
diff --git a/publish.el b/publish.el
index ee580f0..664be9a 100644
--- a/publish.el
+++ b/publish.el
@@ -2,16 +2,20 @@
(defvar this-date-format "%Y-%m-%d")
-(defun me/html-preamble-post (plist)
+(defun me/html-preamble (plist)
"PLIST: An entry."
(if (org-export-get-date plist this-date-format)
(plist-put plist
- :subtitle (format "Published on %s by %s"
+ :subtitle (format "Published on %s"
(org-export-get-date plist this-date-format)
- (car (plist-get plist :author)))))
+ )))
;; Preamble
(with-temp-buffer
- (insert-file-contents "../html-templates/post-preamble.html") (buffer-string)))
+ (insert-file-contents "../html-templates/preamble.html") (buffer-string)))
+
+(defun me/html-postamble (plist)
+ (with-temp-buffer
+ (insert-file-contents "../html-templates/postamble.html") (buffer-string)))
(defun me/org-posts-sitemap-format-entry (entry style project)
"Format posts with author and published data in the index page.
@@ -20,11 +24,12 @@ ENTRY: file-name
STYLE:
PROJECT: `posts in this case."
(cond ((not (directory-name-p entry))
- (format "*[[file:posts/%s][%s]]* - %s"
+ (format "%s - *[[file:posts/%s][%s]]*"
+ (format-time-string this-date-format
+ (org-publish-find-date entry project))
entry
(org-publish-find-title entry project)
- (format-time-string this-date-format
- (org-publish-find-date entry project))))
+ ))
((eq style 'tree) (file-name-nondirectory (directory-file-name entry)))
(t entry)))
@@ -57,50 +62,57 @@ STYLE:
PROJECT: `posts in this case."
(cond ((not (directory-name-p entry))
(format "*[[%s][%s]]* - %s\n<<%s>>\n\n%s"
- (org-publish-find-title entry project)
+ (file-name-sans-extension entry)
(format-time-string this-date-format
(org-publish-find-date entry project))
(org-publish-find-title entry project)
- (org-publish-find-title entry project)
+ (file-name-sans-extension entry)
(org-publish-find-content entry project)
))
((eq style 'tree) (file-name-nondirectory (directory-file-name entry)))
(t entry)))
+(defun me/org-publish-microblog (plist filename pub-dir)
+ "Publish RSS with PLIST, only when FILENAME is '../pages/microblog.org'.
+PUB-DIR is when the output will be placed."
+ (if (equal "../pages/microblog.org" (file-name-nondirectory filename))
+ (org-html-publish-to-html plist filename pub-dir)))
+
(setq org-publish-project-alist
'(("posts"
:base-directory "posts/"
:base-extension "org"
:publishing-directory "site/posts"
- :recursive t
+ :recursive nil
:publishing-function org-html-publish-to-html
:auto-sitemap t
+ :section-numbers nil
:sitemap-format-entry me/org-posts-sitemap-format-entry
- :sitemap-title "All posts"
+ :sitemap-title "Yuchen's Blog"
:sitemap-sort-files anti-chronologically
:sitemap-filename "../pages/blog.org"
:html-head "<link rel='stylesheet' href='../css/default.css' type='text/css'/>"
- :html-preamble me/html-preamble-post
+ :html-preamble me/html-preamble
:html-self-link-headlines t
:author ("Yuchen Pei")
- :html-postamble ""
+ :html-postamble me/html-postamble
)
("microposts"
:base-directory "microposts/"
:base-extension "org"
:publishing-directory "site/microposts"
:recursive t
- :publishing-function org-html-publish-to-html
+ :publishing-function me/org-publish-microblog
:auto-sitemap t
:sitemap-format-entry me/org-microposts-sitemap-format-entry
:sitemap-function me/org-microposts-sitemap
- :sitemap-title "Microblog"
+ :sitemap-title "Yuchen's Microblog"
:sitemap-sort-files anti-chronologically
:sitemap-filename "../pages/microblog.org"
:html-head "<link rel='stylesheet' href='../css/default.css' type='text/css'/>"
- :html-preamble me/html-preamble-post
+ :html-preamble me/html-preamble
:author ("Yuchen Pei")
- :html-postamble ""
+ :html-postamble me/html-postamble
)
("pages"
:base-directory "pages/"
@@ -108,10 +120,11 @@ PROJECT: `posts in this case."
:publishing-directory "site/"
:recursive t
:publishing-function org-html-publish-to-html
- :html-head "<link rel='stylesheet' href='../css/default.css' type='text/css'/>"
- :html-preamble me/html-preamble-post
+ :html-head "<link rel='stylesheet' href='../css/default.css' type='text/css'/>
+ <link rel='stylesheet' href='../css/page.css' type='text/css'/>"
+ :html-preamble me/html-preamble
:author ("Yuchen Pei")
- :html-postamble ""
+ :html-postamble me/html-postamble
:html-prefer-user-labels t
)
("css"