Making Org Publish config neater

Previously I had a huge config file for org-publish, most of it was just repeated. I didn't know Emacs Lisp so I just added more on new projects but I've been trying to learn E-Lisp & made my config neater.

This is how I generate my Project's webpages. All my projects are in ~/projects/ directory, projects is a list of my projects name & this iterates over it to add my projects to org-publish-project-alist.

(require 'cl)
(setq projects
      '("pavo" "orion" "grus" "cetus" "lyra" "lynx" "hydra" "pyxis"
        "indus" "perseus" "pictor" "ara" "crux" "leo"))

(setq org-publish-project-alist
      (append org-publish-project-alist
              (loop for project in projects
                    (list project
                          :base-directory (concat "~/projects/" project)
                          :base-extension "org"
                          :publishing-directory (concat "~/public_html/" (car projects))
                          :publishing-function (quote org-html-publish-to-html)
                          :html-head-include-default-style nil
                          :html-head-include-scripts nil
                          :section-numbers nil))))

So I used to copy-paste the same thing for all my projects earlier. Also, #emacs@freenode is very helpful.

2020-09-15 Tuesday 00:28

That piece of code was producing unexpected results. I had (car projects) in there which meant that all my projects were being exported to the first project name in list which was pavo.

:publishing-directory (concat "~/public_html/" (car projects))

Replacing that line with this fixed it:

:publishing-directory (concat "~/public_html/" project)

Andinus / 2020-09-01 / Modified: 2020-10-06 Tue 23:29 Emacs 27.1 (Org mode 9.4)