blob: cfe2573292ff522a39fc6bf4e62e3ceda5eb45c7 (
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
89
90
91
92
93
94
95
96
97
98
99
100
|
(require 'xmlgen)
(require 'ox-publish)
(setopt org-export-global-macros '(("timestamp" . "@@html:<br/><time id=\"posted\">$1</time>@@"))
org-html-htmlize-output-type nil)
(defun blog/org-publish-sitemap-default-entry (entry style project)
(cond ((not (directory-name-p entry))
(format "[[file:%s][%s]] {{{timestamp(%s)}}}"
entry
(org-publish-find-title entry project)
(format-time-string "%B %d\\, %Y"
(org-publish-find-date entry project))))
((eq style 'tree)
(file-name-nondirectory (directory-file-name entry)))
(t entry)))
(defconst kleidi-ca-header
(xmlgen
'(header :style "margin: 3em 0 3em 0; display: flex; gap: 8px; flex-direction: column; font-family: monospace"
(span "Kleidi Bujari <" (a :href "mailto:mail@4kb.net" "mail@4kb.net") ">")
(nav :style "display: flex; gap: 8px"
(span (a :href "/" "kleidi.ca" ) " |")
(a :href "/about.html" "about")
(a :href "/posts/" "posts")
(a :href "/reviews" "paper reviews")
(a :href "https://github.com/kbujari" :target "_blank" "github"))))
"Common <header> compononent that should appear on most HTML pages")
(defconst kleidi-ca-statics
(concat (xmlgen '(link :rel "icon" :href "/favicon.ico" :type "image/x-icon"))
"\n"
(xmlgen '(link :rel "stylesheet" :href "/main.css" :type "text/css"))))
(setopt org-publish-project-alist
`(("orgfiles"
:base-directory "~/org"
:include ("index.org" "about.org")
:publishing-directory "~/public_html"
:recursive nil
:section-numbers nil
:with-toc nil
;; :auto-sitemap t
;; :sitemap-filename "index.org"
;; :sitemap-title ""
;; :sitemap-format-entry blog/org-publish-sitemap-default-entry
;; :sitemap-sort-files anti-chronologically
;; :sitemap-function blog/sitemap-function
:html-head nil
:html-head-extra ,kleidi-ca-statics
:html-head-include-scripts nil
:html-head-include-default-style nil
:html-postamble nil
:html-preamble ,kleidi-ca-header)
("posts"
:base-directory "~/org/posts"
:base-extension "org"
:publishing-directory "~/public_html/posts"
:section-numbers nil
:with-toc nil
:auto-sitemap t
:recursive t
:sitemap-sort-files anti-chronologically
;; :sitemap-function blog/sitemap-function
:sitemap-format-entry blog/org-publish-sitemap-default-entry
:sitemap-title "Posts"
:sitemap-filename "index.org"
:sitemap-style list
:html-head nil
:html-head-extra ,kleidi-ca-statics
:html-head-include-scripts nil
:html-head-include-default-style nil
:html-postamble nil
:html-preamble ,kleidi-ca-header)
("css"
:base-directory "~/org"
:base-extension "css\\|png\\|ico"
:publishing-directory "~/public_html"
:recursive t
:publishing-function org-publish-attachment)
("kleidi.ca" :components ("orgfiles" "posts" "css"))))
(defun make-kleidi-ca ()
"Build kleidi.ca site and publish to public_html/"
(interactive)
(require 'ox-publish)
(org-publish "kleidi.ca" t))
(defun kleidi-ca/compile ()
"Live preview of published kleidi.ca site in public_html/"
(interactive)
(compile "nix run nixpkgs#python3 -- -m http.server 8080 --bind 0.0.0.0 --directory ~/public_html"))
(keymap-global-set "C-x C-/" 'make-kleidi-ca)
(provide 'kleidi-ca)
|