-
Notifications
You must be signed in to change notification settings - Fork 0
/
export.el
105 lines (100 loc) · 4.84 KB
/
export.el
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
101
102
103
104
105
;;; export.el --- Generate static site using weblorg.el
;; Setup packages
(add-to-list 'load-path ".")
(load "init")
;; Set site wide configuration
(setq weblorg-default-url (let ((base-url (getenv "BASE_URL")))
(if (string= base-url "") "http://localhost:8080" base-url)))
(let ((site (weblorg-site
:base-url weblorg-default-url
:default-route "org-nodes"
:theme nil
:template-vars '(("title" . "nanzho.ng")
("name" . "Nan Zhong")
("menu" . ((("name" . "nanzho.ng")
("url" . "/"))
(("name" . "org")
("url" . "/org/"))
(("name" . "posts")
("url" . "/posts/"))))
("projects" . (("personal" . ((("name" . "nanzhong/env")
("desc" . "My declarative environments")
("url" . "https://github.com/nanzhong/workstation"))
(("name" . "nanzhong/tstr")
("desc" . "Test runner and reporting framework")
("url" . "https://github.com/nanzhong/tstr"))))
("professional" . ((("name" . "DigitalOcean App Platform")
("desc" . "Opinionated PaaS")
("url". "https://www.digitalocean.com/docs/app-platform/"))
(("name" . "DigitalOcean Kubernetes Service")
("desc" . "Managed kubernetes product")
("url" . "https://www.digitalocean.com/docs/kubernetes/"))))))
;; Social
("twitter" . "nanzhong")
("github" . "nanzhong")
("email" . "[email protected]"))))
(org-roam-nodes-filter (lambda (node)
(member "publish" (org-roam-node-tags node)))))
;; Temporarily disabled until I have an actual "page"...
;; (weblorg-route
;; :name "pages"
;; :input-pattern "pages/*.org"
;; :template "page.html"
;; :output "output/{{ slug }}/index.html"
;; :url "/{{ slug }}/"
;; :site site)
(weblorg-route
:name "posts"
:input-pattern "posts/**/*.org"
:template "post.html"
:output "output/posts/{{ slug }}/index.html"
:url "/posts/{{ slug }}/"
:site site)
(weblorg-route
:name "posts-list"
:input-pattern "posts/**/*.org"
:input-aggregate #'weblorg-input-aggregate-all-desc
:template "posts.html"
:output "output/posts/index.html"
:url "/posts"
:site site)
(weblorg-route
:name "org"
:input-pattern "org.org"
:template-vars (let* ((org-nodes (cdr (assoc "nodes" (car (weblorg-input-source-org-roam-nodes-agg
org-roam-nodes-filter))))))
`(("nodes" . ,org-nodes)))
:template "org.html"
:output "output/org/index.html"
:url "/org"
:site site)
(weblorg-route
:name "org-nodes"
:input-source (lambda () (weblorg-input-source-org-roam-nodes org-roam-nodes-filter))
:template "org-node.html"
:output "output/org/{{ slug }}/index.html"
:url "/org/{{ slug }}/"
:site site)
(weblorg-route
:name "index"
:input-pattern "index.org"
:template-vars (let* ((posts (weblorg--route-posts (weblorg--site-route site "posts-list")))
(posts (cdr (assoc "posts" (car posts))))
(org-nodes (cdr (assoc "nodes" (car (weblorg-input-source-org-roam-nodes-agg
org-roam-nodes-filter
(lambda (a b)
(time-less-p (org-roam-node-file-mtime b)
(org-roam-node-file-mtime a)))
5))))))
`(("posts" . ,(butlast posts (- (length posts) 5)))
("nodes" . ,org-nodes)))
:template "index.html"
:output "output/index.html"
:url "/"
:site site)
(weblorg-copy-static
:output "output/assets/{{ file }}"
:url "/assets/{{ file }}")
(setq debug-on-error t)
(weblorg-export))
;;; export.el ends here