Commit 504e8fbde8
Unsigned
Layout: unified · split
publish.el +19 −13
| @@ -1,22 +1,26 @@ | |||
| 1 | ;; explicity load packages since I'm using Doom Emacs | 1 | ;; Explicitly load packages for Doom Emacs |
| 2 | |||
| 2 | (add-to-list 'load-path "~/.emacs.d/.local/straight/repos/emacs-htmlize") | 3 | (add-to-list 'load-path "~/.emacs.d/.local/straight/repos/emacs-htmlize") |
| 3 | (add-to-list 'load-path "~/.emacs.d/.local/straight/repos/weblorg") | 4 | (add-to-list 'load-path "~/.emacs.d/.local/straight/repos/weblorg") |
| 4 | (add-to-list 'load-path "~/.emacs.d/.local/straight/repos/templatel") | 5 | (add-to-list 'load-path "~/.emacs.d/.local/straight/repos/templatel") |
| 6 | |||
| 5 | (require 'htmlize) | 7 | (require 'htmlize) |
| 6 | (require 'weblorg) | 8 | (require 'weblorg) |
| 7 | 9 | ||
| 8 | ;; defaults to http://localhost:8000 | 10 | ;; Set default URL for Weblorg |
| 9 | ;; ENV=prod emacs --script publish.el | ||
| 10 | (if (string= (getenv "ENV") "prod") | 11 | (if (string= (getenv "ENV") "prod") |
| 11 | (setq weblorg-default-url "https://cleberg.net")) | 12 | (setq weblorg-default-url "https://cleberg.net")) |
| 12 | 13 | ||
| 14 | ;; Define site configuration | ||
| 13 | (weblorg-site | 15 | (weblorg-site |
| 14 | :theme nil | 16 | :theme nil |
| 15 | :template-vars '(("site_name" . "cleberg.net") | 17 | :template-vars `(("site_name" . "cleberg.net") |
| 16 | ("site_owner" . "Christian Cleberg <hello@cleberg.net>") | 18 | ("site_owner" . "Christian Cleberg <hello@cleberg.net>") |
| 17 | ("site_description" . "Just a blip of ones and zeroes."))) | 19 | ("site_description" . "Just a blip of ones and zeroes."))) |
| 18 | 20 | ||
| 19 | ;; route for rendering the index page of the website | 21 | ;; Define routes for rendering content |
| 22 | |||
| 23 | ;; Index page route | ||
| 20 | (weblorg-route | 24 | (weblorg-route |
| 21 | :name "index" | 25 | :name "index" |
| 22 | :input-pattern "content/index.org" | 26 | :input-pattern "content/index.org" |
| @@ -24,7 +28,7 @@ | |||
| 24 | :output ".build/index.html" | 28 | :output ".build/index.html" |
| 25 | :url "/") | 29 | :url "/") |
| 26 | 30 | ||
| 27 | ;; route for rendering each post | 31 | ;; Blog post route |
| 28 | (weblorg-route | 32 | (weblorg-route |
| 29 | :name "blog" | 33 | :name "blog" |
| 30 | :input-pattern "content/blog/*.org" | 34 | :input-pattern "content/blog/*.org" |
| @@ -32,7 +36,7 @@ | |||
| 32 | :output ".build/blog/{{ slug }}.html" | 36 | :output ".build/blog/{{ slug }}.html" |
| 33 | :url "/blog/{{ slug }}.html") | 37 | :url "/blog/{{ slug }}.html") |
| 34 | 38 | ||
| 35 | ;; route for rendering the index page of the blog | 39 | ;; Blog index page route |
| 36 | (weblorg-route | 40 | (weblorg-route |
| 37 | :name "blog-index" | 41 | :name "blog-index" |
| 38 | :input-pattern "content/blog/*.org" | 42 | :input-pattern "content/blog/*.org" |
| @@ -41,7 +45,7 @@ | |||
| 41 | :output ".build/blog/index.html" | 45 | :output ".build/blog/index.html" |
| 42 | :url "/blog/") | 46 | :url "/blog/") |
| 43 | 47 | ||
| 44 | ;; route for rendering each wiki post | 48 | ;; Wiki post route |
| 45 | (weblorg-route | 49 | (weblorg-route |
| 46 | :name "wiki" | 50 | :name "wiki" |
| 47 | :input-pattern "content/wiki/*.org" | 51 | :input-pattern "content/wiki/*.org" |
| @@ -49,7 +53,7 @@ | |||
| 49 | :output ".build/wiki/{{ slug }}.html" | 53 | :output ".build/wiki/{{ slug }}.html" |
| 50 | :url "/wiki/{{ slug }}.html") | 54 | :url "/wiki/{{ slug }}.html") |
| 51 | 55 | ||
| 52 | ;; route for rendering the index page of the wiki | 56 | ;; Wiki index page route |
| 53 | (weblorg-route | 57 | (weblorg-route |
| 54 | :name "wiki-index" | 58 | :name "wiki-index" |
| 55 | :input-pattern "content/wiki/*.org" | 59 | :input-pattern "content/wiki/*.org" |
| @@ -58,7 +62,7 @@ | |||
| 58 | :output ".build/wiki/index.html" | 62 | :output ".build/wiki/index.html" |
| 59 | :url "/wiki/") | 63 | :url "/wiki/") |
| 60 | 64 | ||
| 61 | ;; route for rendering each page | 65 | ;; Page post route |
| 62 | (weblorg-route | 66 | (weblorg-route |
| 63 | :name "pages" | 67 | :name "pages" |
| 64 | :input-pattern "content/*.org" | 68 | :input-pattern "content/*.org" |
| @@ -66,6 +70,7 @@ | |||
| 66 | :output ".build/{{ slug }}.html" | 70 | :output ".build/{{ slug }}.html" |
| 67 | :url "/{{ slug }}.html") | 71 | :url "/{{ slug }}.html") |
| 68 | 72 | ||
| 73 | ;; Salary page route | ||
| 69 | (weblorg-route | 74 | (weblorg-route |
| 70 | :name "salary" | 75 | :name "salary" |
| 71 | :input-pattern "content/salary/*.org" | 76 | :input-pattern "content/salary/*.org" |
| @@ -73,6 +78,7 @@ | |||
| 73 | :output ".build/salary/{{ slug }}.html" | 78 | :output ".build/salary/{{ slug }}.html" |
| 74 | :url "/salary/{{ slug }}.html") | 79 | :url "/salary/{{ slug }}.html") |
| 75 | 80 | ||
| 81 | ;; Services page route | ||
| 76 | (weblorg-route | 82 | (weblorg-route |
| 77 | :name "services" | 83 | :name "services" |
| 78 | :input-pattern "content/services/*.org" | 84 | :input-pattern "content/services/*.org" |
| @@ -80,7 +86,7 @@ | |||
| 80 | :output ".build/services/{{ slug }}.html" | 86 | :output ".build/services/{{ slug }}.html" |
| 81 | :url "/services/{{ slug }}.html") | 87 | :url "/services/{{ slug }}.html") |
| 82 | 88 | ||
| 83 | ;; RSS Feed | 89 | ;; RSS feed route |
| 84 | (weblorg-route | 90 | (weblorg-route |
| 85 | :name "rss" | 91 | :name "rss" |
| 86 | :input-pattern "content/blog/*.org" | 92 | :input-pattern "content/blog/*.org" |
| @@ -89,10 +95,10 @@ | |||
| 89 | :output ".build/feed.xml" | 95 | :output ".build/feed.xml" |
| 90 | :url "/feed.xml") | 96 | :url "/feed.xml") |
| 91 | 97 | ||
| 92 | ;; route for static assets that also copies files to .build directory | 98 | ;; Copy static assets and output to .build directory |
| 93 | (weblorg-copy-static | 99 | (weblorg-copy-static |
| 94 | :output ".build/{{ file }}" | 100 | :output ".build/{{ file }}" |
| 95 | :url "/{{ file }}") | 101 | :url "/{{ file }}") |
| 96 | 102 | ||
| 97 | ;; fire the engine and export all the files declared in the routes above | 103 | ;; Export all content using Weblorg engine |
| 98 | (weblorg-export) | 104 | (weblorg-export) |