]> git.vanrenterghem.biz Git - www2.vanrenterghem.biz.git/blob - maak-website.el
1bb4897df7156725ce6da9d3cd00b151f34b85b8
[www2.vanrenterghem.biz.git] / maak-website.el
1 (require 'ox-publish)
3 (setq org-html-doctype "html5")
4 (setq org-html-divs '((preamble "header" "top")
5                         (content "main" "content")
6                         (postamble "footer" "postamble"))
7       org-html-container-element "section")
8 (setq org-html-head-include-default-style nil)
9 ;(setq org-html-htmlize-output-type 'css) ; default: 'inline-css
11 (defun website-header (info)
12   (with-temp-buffer
13     (insert-file-contents "~/websites/stage.vanrenterghem.biz/html/navbar.html")
14     (buffer-string)))
16 (defun post-header (exp-plist)
17   (with-temp-buffer
18     (insert (format "<nav aria-label=\"breadcrumb\">
19               <ol class=\"breadcrumb\">
20                <li class=\"breadcrumb-item\"><a href=\"/\">Home</a></li>
21                <li class=\"breadcrumb-item\"><a href=\"/sitemap.html\">Blog</a></li>
22                <li class=\"breadcrumb-item active\" aria-current=\"page\">%s</li>
23               </ol>
24             </nav>"
25             (or (org-export-data (plist-get exp-plist ':title) exp-plist)
26                 "none")))
27     (goto-char (point-min))
28     (insert-file-contents "~/websites/stage.vanrenterghem.biz/html/post-header.html")
29     ;(goto-char (point-max))
30     ;(insert (format "<p>Tags: %s</p>"
31         ;           (or (org-export-data (plist-get exp-plist :filetags) exp-plist)
32         ;       "none")))
33     (buffer-string)))
35 (defun website-footer (info)
36   (with-temp-buffer
37     (insert-file-contents "~/websites/stage.vanrenterghem.biz/html/footer.html")
38     (buffer-string)))
40 (defun my-org-publish-sitemap-default-entry (entry style project)
41   "My format for site map ENTRY, as a string.
42 ENTRY is a file name.  STYLE is the style of the sitemap.
43 PROJECT is the current project."
44   (cond ((not (directory-name-p entry))
45          (format "%s - [[file:%s][%s]]" ;;the date and filename are added after the entry
46                  (format-time-string "%e %b %Y" (org-publish-find-date entry project))
47                  entry
48                  (org-publish-find-title entry project)))
49         ((eq style 'tree)
50          ;; Return only last subdir.
51          (file-name-nondirectory (directory-file-name entry)))
52         (t entry)))
54 (setq org-publish-project-alist
55       '(("pages"
56          :base-directory "~/websites/stage.vanrenterghem.biz/source/"
57          :base-extension "org"
58          :publishing-directory "~/websites/stage.vanrenterghem.biz/target"
59          :publishing-function org-html-publish-to-html
60          :headline-levels 3
61          :section-numbers nil
62          :with-toc nil
63          :html-head-include-default-style nil
64          :html-head "<link href=\"/assets/styles/bootstrap-5.3.0/css/bootstrap.min.css\" rel=\"stylesheet\" />"
65          :html-preamble t
66          :html-preamble website-header
67          :html-postamble website-footer
68          )
70         ("posts"
71          :base-directory "~/websites/stage.vanrenterghem.biz/source/posts/"
72          :base-extension "org"
73          :publishing-directory "~/websites/stage.vanrenterghem.biz/target"
74          :publishing-function org-html-publish-to-html
75          :exclude "assets*\\|sitemap.org\\|index.org" ;; regexp
76          :html-content-class "container content inlinepage card h-entry"
77          :headline-levels 3
78          :section-numbers nil
79          :with-toc nil
80          :with-title nil
81          :html-head-include-default-style nil
82          :html-head "<link href=\"/assets/styles/bootstrap-5.3.0/css/bootstrap.min.css\" rel=\"stylesheet\" />\n
83          <link href=\"/assets/styles/org-htmlize.css\" rel=\"stylesheet\" />"
84          :html-preamble t
85          :html-divs ((preamble "header" "preamble")
86             (content "article" "inlinepage card h-entry")
87             (postamble "footer" "postamble"))
88          :recursive t
89          :auto-sitemap t
90          :html-preamble post-header
91          :html-postamble website-footer
92          :sitemap-sort-folders ignore-errors
93          :sitemap-format-entry my-org-publish-sitemap-default-entry
94          :sitemap-sort-files anti-chronologically
95          )
97         ("assets"
98          :base-directory "~/websites/stage.vanrenterghem.biz/source/assets/"
99          :base-extension any
100          :recursive t
101          :publishing-directory "~/websites/stage.vanrenterghem.biz/target/assets/"
102          :publishing-function org-publish-attachment)
104         ("website" :components ("posts" "pages" "assets"))))