I am attempting to use org-publish for site generation, and want to alter the html elements currently being exported.

Using #+INCLUDE statements within the org files doesn't allow for the markup I am after, so I think the best approach is to adjust the :html-preamble and :html-postamble arguments within the org-publish-project-alist variable.

When including :html-preamble and :html-postamble properties the default markup exported goes something like this:

<div id="preamble" class="status">...</div>
<div id="content" class="content">...</div>
<div id="postamble" class="status">...</div>

however I want to change the divs to a more semantic markup such as this:

<header id="preamble">...</header>
<main id="content">...</main>
<footer id="postamble">...</footer>

I thought this could be acheived by setting the :html-divs property like so:

:html-divs '((preamble "header" "preamble")
             (content "main" "content")
             (postamble "footer" "postamble"))

but this results in:

<nil id="nil" class="status">...</nil>
<nil id="nil" class="content">...</nil>
<nil id="nil" class="status">...</nil>

I have no idea why and could do with some pointers here.

To look over my code visit the project on gitlab

1 Answer 1


Do not quote property values inside the (quasi-)quoted form that you set org-publish-project-alist to! That's too much quoting.


:html-divs ((preamble "header" "preamble")
            (content "main" "content")
            (postamble "footer" "postamble"))

You've already (quasi-)quoted the whole value. If you quote the inner value, all you are doing is wrapping it in a quote form:

:html-divs (quote ((preamble "header" "preamble")
                   (content "main" "content")
                   (postamble "footer" "postamble")))

which stays there because of the outer (quasi-)quote, so the value is a list of two things: the symbol quote and a list of three lists. The code however expects it to be a list of three lists: chaos ensues :-)

  • I need at least 15 reputation to cast a vote as I am new to this site, but thank you sir. That is exactly the solution. You're awesome!
    – baaash
    Commented Apr 1, 2023 at 2:41
  • Glad it helped!
    – NickD
    Commented Apr 1, 2023 at 2:54

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.