Web-site in org-mode

The previous version of barrybridgens.com was authored using Hugo but I was never really happy with it. There were too many "moving parts" that were not east to find / understand. I decided to re-write the web-site and was originally going to just use HTML and CCS but then decided to re-visit creating web-sites from org-mode. I had tried generating web-sites from org-mode before but didn't really "click". This time I found really good write-ups from System Crafters and Thomas Ingram that got me started.

I knowledge and code from the above sources and had a simple web-site / blog up and running fairly quickly. I then ported my content, including the three most recent blog posts, from the Hugo version of the site. I may go back and port the other blog posts later as they will remain on Github.

The initial version of the org-mode "export" script is 77 lines of elisp (including whitespace).

; Set the package installation directory so that packages aren't stored in the
;; ~/.emacs.d/elpa path.
(require 'package)
(setq package-user-dir (expand-file-name "./.packages"))
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
                         ("elpa" . "https://elpa.gnu.org/packages/")))

;; Initialize the package system
(package-initialize)
(unless package-archive-contents
  (package-refresh-contents))

;; Install dependencies
(package-install 'htmlize)

;; Load the publishing system
(require 'ox-publish)

;; Customize the HTML output
(setq org-html-validation-link nil            ;; Don't show validation link
      org-html-head-include-scripts nil       ;; Use our own scripts
      org-html-head-include-default-style nil ;; Use our own styles
      org-html-head "<link rel=\"stylesheet\" href=\"/style.css\"/>")


(setq org-publish-project-alist
      `(("pages"
         :base-directory "./content/"
         :base-extension "org"
         :recursive nil
         :with-toc nil
         :section-numbers nil
         :time-stamp-file nil
         :publishing-directory "./public"
         :html-postamble "<hr/><footer>Author: Barry Bridgens<br><nav> <a href=\"/\">&lt; Home</a></nav><div id=\"updated\">Updated: %C</div><hr></footer>"
         :publishing-function org-html-publish-to-html)

        ("static"
         :base-directory "./content/"
         :base-extension "css\\|txt"
         :recursive t
         :publishing-directory  "./public"
         :publishing-function org-publish-attachment)

        ("images"
         :base-directory "./content/"
         :base-extension "jpg\\|gif\\|png"
         :recursive nil
         :publishing-directory  "./public/images"
         :publishing-function org-publish-attachment)

        ("blog"
         :base-directory "./content/blog/"
         :base-extension "org"
         :with-toc nil
         :section-numbers nil
         :time-stamp-file nil
         :publishing-directory "./public/blog"
         :html-postamble "<hr/><footer>Author: Barry Bridgens<br><nav> <a href=\"/\">&lt; Home</a></nav><div id=\"updated\">Updated: %C</div><hr></footer>"
         :publishing-function org-html-publish-to-html

         :auto-sitemap t
         :sitemap-title "Blog Posts"
         :sitemap-filename "index.org"
         :sitemap-sort-files anti-chronologically)

        ("blog-images"
         :base-directory "./content/blog/images"
         :base-extension "jpg\\|gif\\|png"
         :recursive nil
         :publishing-directory  "./public/blog/images"
         :publishing-function org-publish-attachment)   

        ("org-site" :components ("pages" "blog" "static" "images"))))

;; Generate the site output
(org-publish-all t)

(message "Build complete!")

This is much easier to understand and will be much easier to maintain than the Hugo version.