blob: f4587c77b0a14f0a6302ae8d1725f741ccc977e5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
(package-initialize)
(require 'ox-publish)
(require 'webfeeder)
(setq org-html-validation-link nil
org-html-head-include-scripts nil
org-html-doctype "html5"
org-html-html5-fancy t
org-html-head-include-default-style nil
org-html-head (with-temp-buffer
(insert-file-contents "head.html")
(buffer-string)))
(defun my/sitemap-format-entry (entry style project)
(let ((filename (org-publish-find-title entry project))
(date (org-publish-find-date entry project)))
(format "%s - [[file:%s][%s]]"
(format-time-string "%F" date)
entry
filename)))
(defun my/sitemap-function (title list) ; todo change this
(org-publish-sitemap-default title list))
(defun my/body-query (html-file &optional _url _with-toc)
"Replaces the <description> tag in the RSS output with the contents of <meta name=description>.
Arguments beginning with _ are required for the function to work but are unused."
(with-temp-buffer
(insert-file-contents html-file)
(let* ((dom (libxml-parse-html-region (point-min) (point-max)))
(meta-tags (dom-by-tag dom 'meta)))
(cl-loop for (_meta ((_ . name-value) (_ . content-value))) in meta-tags
when (string= name-value "description")
return content-value))))
(setq org-publish-project-alist
(list
(list "blog"
:recursive t
:base-directory "./src/blog"
:publishing-directory "./public/blog"
:publishing-function 'org-html-publish-to-html
:section-numbers nil
:with-toc nil
:auto-sitemap t
:time-stamp-file nil
:sitemap-title "Lemurblog"
:sitemap-filename "index.org"
:sitemap-sort-files 'anti-chronologically
:sitemap-format-entry 'my/sitemap-format-entry
:sitemap-function 'my/sitemap-function)
(list "pages"
:recursive nil
:base-directory "./src"
:publishing-function 'org-html-publish-to-html
:publishing-directory "./public"
:with-toc nil
:html-postamble nil
:section-numbers nil
:time-stamp-file nil)
(list "assets"
:recursive t
:base-directory "./src/assets"
:base-extension 'any
:publishing-function 'org-publish-attachment
:publishing-directory "./public/assets")))
(delete-directory "public" :recursive t)
(org-publish-all t)
(let ((webfeeder-body-function 'my/body-query))
(setenv "TZ" "UTC0") ; remove the timezone from webfeeder output
(webfeeder-build
"rss.xml"
"./public/blog"
"https://lemurianmage.srht.site"
(seq-filter
(lambda (x) (not (or (file-directory-p x) (string= x "index.html"))))
(directory-files "public/blog")) ; no ".", "..", and index.html
:author "The Lemurian Mage"
:title "Lemurblog"
:generator "The Lemurian Mage's Little Lemur Hands"
:builder 'webfeeder-make-rss
:build-date 0))
(message "Build done!")
|