aboutsummaryrefslogtreecommitdiff
path: root/publish.el
blob: aecdb0f1a7c3cb76130e6bcbc556fd4000916dae (plain) (blame)
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
;;; -*- lexical-binding: t -*-
(setq debug-on-error t)

;; Allow for macOS (dev machine) & Linux (GitHub Actions) execution
(defvar site-lisp-base
  (expand-file-name "~/.config/emacs/.local/straight/repos"))

;; Explicitly load packages
(add-to-list 'load-path (expand-file-name "htmlize" site-lisp-base))
(add-to-list 'load-path (expand-file-name "weblorg" site-lisp-base))
(add-to-list 'load-path (expand-file-name "templatel" site-lisp-base))

(require 'htmlize)
(require 'templatel)
(require 'weblorg)

;; Set default URL for Weblorg
;; Only works if environment variable ENV=prod
(if (string-equal-ignore-case (or (getenv "ENV") "") "prod")
    (setq weblorg-default-url "https://cleberg.net"))

;; Define site metadata
(weblorg-site
 :theme nil
 :template-vars '(("site_name"        . "cleberg.net")
                  ("site_owner"       . "Christian Cleberg <[email protected]>")
                  ("site_description" . "Stillness amidst the chaos.")))

;; Define routes for rendering content

;; Index page route
(weblorg-route
 :name "index"
 :input-pattern "content/*.org"
 :template "index.html"
 :output ".build/index.html"
 :url "/")

;; Blog post route
(weblorg-route
 :name "blog"
 :input-pattern "content/blog/*.org"
 :template "post.html"
 :output ".build/blog/{{ slug }}.html"
 :url "/blog/{{ slug }}.html")

;; Blog index page route
(weblorg-route
 :name "blog-index"
 :input-pattern "content/blog/*.org"
 :input-aggregate #'weblorg-input-aggregate-all-desc
 :template "blog.html"
 :output ".build/blog/index.html"
 :url "/blog/")

;; Garden post route
(weblorg-route
 :name "garden"
 :input-pattern "content/garden/*.org"
 :template "post.html"
 :output ".build/garden/{{ slug }}.html"
 :url "/garden/{{ slug }}.html")

;; Garden index page route
(weblorg-route
 :name "garden-index"
 :input-pattern "content/garden/*.org"
 :input-aggregate #'weblorg-input-aggregate-all-desc
 :template "garden.html"
 :output ".build/garden/index.html"
 :url "/garden/")

;; Page post route
(weblorg-route
 :name "pages"
 :input-pattern "content/*.org"
 :template "page.html"
 :output ".build/{{ slug }}.html"
 :url "/{{ slug }}.html")

;; Salary page route
(weblorg-route
 :name "salary"
 :input-pattern "content/salary/*.org"
 :template "page.html"
 :output ".build/salary/{{ slug }}.html"
 :url "/salary/{{ slug }}.html")

;; Now page route
(weblorg-route
 :name "now"
 :input-pattern "content/now/*.org"
 :template "post.html"
 :output ".build/now/{{ slug }}.html"
 :url "/now/{{ slug }}.html")

;; Uses page route
(weblorg-route
 :name "uses"
 :input-pattern "content/uses/*.org"
 :template "page.html"
 :output ".build/uses/{{ slug }}.html"
 :url "/uses/{{ slug }}.html")

;; Tips page route
(weblorg-route
 :name "tips"
 :input-pattern "content/tips/*.org"
 :template "page.html"
 :output ".build/tips/{{ slug }}.html"
 :url "/tips/{{ slug }}.html")

;; RSS feed route
(weblorg-route
 :name "rss"
 :input-pattern "content/blog/*.org"
 :input-aggregate #'weblorg-input-aggregate-all-desc
 :template "feed.xml"
 :output ".build/feed.xml"
 :url "/feed.xml")

;; Copy static assets and output to .build directory
(weblorg-copy-static
 :output ".build/{{ file }}"
 :url "/{{ file }}")

;; Export all content using Weblorg engine
(weblorg-export)