3 ms·
A potentially simpler solution if you just want something like a header on the page(s), org-publish-project-alist elements support a :html-preamble key that you
by bm3719 2y ago
A potentially simpler solution if you just want something like a header on the page(s), org-publish-project-alist elements support a :html-preamble key that you can assign to any custom function on a per-project basis.
That's how I insert a static <nav> header, and therefore don't have to eval any org-babel blocks as it's just integrated into org-publish. Also the function lives in your init.el this way and not an external script.
- adityaathalye 2y agoThanks for the tip! I will look into it for other use cases. In my site maker, however, I explicitly do not want to depend on Emacs for templating or publishing. I have found a works-pretty-well-for-me solution using pandoc's org -> html compiler. It compiles just enough of org's subset for me. Everything else I am happy writing by hand (inline html export blocks written manually). The case I mentioned above was a bit more annoying, so I used the org-babel trick. Basically, I wanted that little panel in arbitrary places in arbitrary pages. I could have hand-written it, and copy-pasta'd all over the place, but then it would be a chore to change anything (e.g. HTML anchor tweaks etc.). The solution I wrote above still requires manual intervention because pandoc does not execute org babel code blocks. However, my hack solves the important part for me --- viz. not making mistakes while copy-pasting, which in turn lets me easily modify source content and update reference content quickly and correctly. What to say, it's still using Emacs, but it's an out-of-band composition of tools. Personally, I think of Emacs as not one self-contained all-encompassing thing. But as a part of a workflow solution suited to my tastes and personal idiosyncracies :)