2

I have a bunch of org-mode files in a directory structure and would like to export to html using org-publish. Not all of them have the #+SETUPFILE: header, and I'd like to avoid having to add that in to every file.

So how do you add the line

#+SETUPFILE: /path/to/my/setupfile.setup

to every org file when org-publish is invoked (especially when a #+SETUPFILE: header is not already present?)

3
  • "... I'd like to avoid adding that to every file": Why? If it is needed, why not add it to every file?
    – NickD
    Jun 4, 2021 at 17:33
  • 2
    Does this answer your question? How to include other .org files programmatically (ie not from main .org file)?
    – volent
    Mar 28, 2022 at 13:01
  • It probably does, but I think it is overly complicated due to that post needing an #+INCLUDE tag. I'll post the solution I found at the time below.
    – JP.
    Apr 24, 2022 at 17:19

1 Answer 1

2

It turns out there is a org-mode variable specifically aimed at providing a header. See the documentation for the emacs variable org-html-head. For my particular case, I put the contents of the orgexp.setup file into the variable.

This is the relevant snippet from my .emacs file:

(setq org-html-head-include-default-style nil)

(setq org-html-head "
<link rel=\"stylesheet\" type=\"text/css\" href=\"https://fniessen.github.io/org-html-themes/src/bigblow_theme/css/htmlize.css\"/>
<link rel=\"stylesheet\" type=\"text/css\" href=\"https://fniessen.github.io/org-html-themes/src/bigblow_theme/css/bigblow.css\"/>
<link rel=\"stylesheet\" type=\"text/css\" href=\"https://fniessen.github.io/org-html-themes/src/bigblow_theme/css/hideshow.css\"/>

<script type=\"text/javascript\" src=\"https://fniessen.github.io/org-html-themes/src/bigblow_theme/js/jquery-1.11.0.min.js\"></script>
<script type=\"text/javascript\" src=\"https://fniessen.github.io/org-html-themes/src/bigblow_theme/js/jquery-ui-1.10.2.min.js\"></script>

<script type=\"text/javascript\" src=\"https://fniessen.github.io/org-html-themes/src/bigblow_theme/js/jquery.localscroll-min.js\"></script>
<script type=\"text/javascript\" src=\"https://fniessen.github.io/org-html-themes/src/bigblow_theme/js/jquery.scrollTo-1.4.3.1-min.js\"></script>
<script type=\"text/javascript\" src=\"https://fniessen.github.io/org-html-themes/src/bigblow_theme/js/jquery.zclip.min.js\"></script>
<script type=\"text/javascript\" src=\"https://fniessen.github.io/org-html-themes/src/bigblow_theme/js/bigblow.js\"></script>
<script type=\"text/javascript\" src=\"https://fniessen.github.io/org-html-themes/src/bigblow_theme/js/hideshow.js\"></script>
<script type=\"text/javascript\" src=\"https://fniessen.github.io/org-html-themes/src/lib/js/jquery.stickytableheaders.min.js\"></script>
"
)

Hope that helps someone else out there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.