Making Org Publish config neater
Table of Contents
Previously I had a huge config file for org-publish
, most of it was just
repeateddeclaration. 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-lib) (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 (cl-loop for project in projects collect (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)))))
So I used to copy-paste the same thing for all my projects earlier.
Also, #emacs@freenode
is very helpful.
2020-09-15
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)
2021-02-12
cl
was depreciated, I replaced it with cl-lib
. I just had to change loop
to cl-loop
& it worked fine.