-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.el
97 lines (82 loc) · 2.41 KB
/
publish.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
;;; publish.el --- Generate Static HTML -*- lexical-binding: t -*-
;;
;; Author: Lincoln Clarete <lincoln@clarete.li>
;;
;; Copyright (C) 2020 Lincoln Clarete
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;
;;; Commentary:
;;
;; How my blog is generated
;;
;;; Code:
;; Initialize packaging system
(require 'package)
(package-initialize)
(add-to-list
'package-archives
'("melpa" . "http://melpa.org/packages/"))
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
;; Install dependencies
(use-package htmlize :config :ensure t)
(use-package rainbow-delimiters :config :ensure t)
;; Configure dependencies
(require 'ox-html)
(require 'weblorg)
(delete-directory "blog/" t)
(make-directory "blog/")
(copy-directory "static-files/" "blog/static")
;; Output HTML with syntax highlight with css classes instead of
;; directly formatting the output.
(setq org-html-htmlize-output-type 'css)
;; Static site generation
(setq weblorg-default-url "https://klovanych.org")
(weblorg-route
:name "index"
:input-pattern "index.org"
:template "index.html"
:output "blog/index.html"
:url "/")
(weblorg-route
:name "posts"
:input-pattern "posts/*.org"
:template "post.html"
:output "blog/posts/{{ slug }}.html"
:url "/posts/{{ slug }}.html")
(weblorg-route
:name "about"
:input-pattern "website-pages/about.org"
:template "index.html"
:output "blog/about.html"
:url "/about.html")
(weblorg-route
:name "rss"
:input-pattern "posts/*.org"
:input-aggregate #'weblorg-input-aggregate-all-desc
:template "rss.xml"
:output "blog/rss.xml"
:url "/rss.xml")
(weblorg-route
:name "blog"
:input-pattern "posts/*.org"
:input-aggregate #'weblorg-input-aggregate-all-desc
:template "blog.html"
:output "blog/index.html"
:url "/blog")
(setq debug-on-error t)
(weblorg-export)
;;; publish.el ends here