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 | 3 | (add-to-list 'load-path "~/.emacs.d/.local/straight/repos/emacs-htmlize") |
| 3 | 4 | (add-to-list 'load-path "~/.emacs.d/.local/straight/repos/weblorg") |
| 4 | 5 | (add-to-list 'load-path "~/.emacs.d/.local/straight/repos/templatel") |
| 6 | ||
| 5 | 7 | (require 'htmlize) |
| 6 | 8 | (require 'weblorg) |
| 7 | 9 | |
| 8 | ;; defaults to http://localhost:8000 | |
| 9 | ;; ENV=prod emacs --script publish.el | |
| 10 | ;; Set default URL for Weblorg | |
| 10 | 11 | (if (string= (getenv "ENV") "prod") |
| 11 | 12 | (setq weblorg-default-url "https://cleberg.net")) |
| 12 | 13 | |
| 14 | ;; Define site configuration | |
| 13 | 15 | (weblorg-site |
| 14 | 16 | :theme nil |
| 15 | :template-vars '(("site_name" . "cleberg.net") | |
| 17 | :template-vars `(("site_name" . "cleberg.net") | |
| 16 | 18 | ("site_owner" . "Christian Cleberg <hello@cleberg.net>") |
| 17 | 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 | 24 | (weblorg-route |
| 21 | 25 | :name "index" |
| 22 | 26 | :input-pattern "content/index.org" |
| @@ -24,7 +28,7 @@ | ||
| 24 | 28 | :output ".build/index.html" |
| 25 | 29 | :url "/") |
| 26 | 30 | |
| 27 | ;; route for rendering each post | |
| 31 | ;; Blog post route | |
| 28 | 32 | (weblorg-route |
| 29 | 33 | :name "blog" |
| 30 | 34 | :input-pattern "content/blog/*.org" |
| @@ -32,7 +36,7 @@ | ||
| 32 | 36 | :output ".build/blog/{{ slug }}.html" |
| 33 | 37 | :url "/blog/{{ slug }}.html") |
| 34 | 38 | |
| 35 | ;; route for rendering the index page of the blog | |
| 39 | ;; Blog index page route | |
| 36 | 40 | (weblorg-route |
| 37 | 41 | :name "blog-index" |
| 38 | 42 | :input-pattern "content/blog/*.org" |
| @@ -41,7 +45,7 @@ | ||
| 41 | 45 | :output ".build/blog/index.html" |
| 42 | 46 | :url "/blog/") |
| 43 | 47 | |
| 44 | ;; route for rendering each wiki post | |
| 48 | ;; Wiki post route | |
| 45 | 49 | (weblorg-route |
| 46 | 50 | :name "wiki" |
| 47 | 51 | :input-pattern "content/wiki/*.org" |
| @@ -49,7 +53,7 @@ | ||
| 49 | 53 | :output ".build/wiki/{{ slug }}.html" |
| 50 | 54 | :url "/wiki/{{ slug }}.html") |
| 51 | 55 | |
| 52 | ;; route for rendering the index page of the wiki | |
| 56 | ;; Wiki index page route | |
| 53 | 57 | (weblorg-route |
| 54 | 58 | :name "wiki-index" |
| 55 | 59 | :input-pattern "content/wiki/*.org" |
| @@ -58,7 +62,7 @@ | ||
| 58 | 62 | :output ".build/wiki/index.html" |
| 59 | 63 | :url "/wiki/") |
| 60 | 64 | |
| 61 | ;; route for rendering each page | |
| 65 | ;; Page post route | |
| 62 | 66 | (weblorg-route |
| 63 | 67 | :name "pages" |
| 64 | 68 | :input-pattern "content/*.org" |
| @@ -66,6 +70,7 @@ | ||
| 66 | 70 | :output ".build/{{ slug }}.html" |
| 67 | 71 | :url "/{{ slug }}.html") |
| 68 | 72 | |
| 73 | ;; Salary page route | |
| 69 | 74 | (weblorg-route |
| 70 | 75 | :name "salary" |
| 71 | 76 | :input-pattern "content/salary/*.org" |
| @@ -73,6 +78,7 @@ | ||
| 73 | 78 | :output ".build/salary/{{ slug }}.html" |
| 74 | 79 | :url "/salary/{{ slug }}.html") |
| 75 | 80 | |
| 81 | ;; Services page route | |
| 76 | 82 | (weblorg-route |
| 77 | 83 | :name "services" |
| 78 | 84 | :input-pattern "content/services/*.org" |
| @@ -80,7 +86,7 @@ | ||
| 80 | 86 | :output ".build/services/{{ slug }}.html" |
| 81 | 87 | :url "/services/{{ slug }}.html") |
| 82 | 88 | |
| 83 | ;; RSS Feed | |
| 89 | ;; RSS feed route | |
| 84 | 90 | (weblorg-route |
| 85 | 91 | :name "rss" |
| 86 | 92 | :input-pattern "content/blog/*.org" |
| @@ -89,10 +95,10 @@ | ||
| 89 | 95 | :output ".build/feed.xml" |
| 90 | 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 | 99 | (weblorg-copy-static |
| 94 | 100 | :output ".build/{{ file }}" |
| 95 | 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 | 104 | (weblorg-export) |