9

It looks like this question was asked in this thread, but was not resolved. I hope it doesn't sound redundant, but it seems there must be a way to accomplish this in org mode.

In my example, I am testing the include with an HTML footer. The footer contains the basic information:

<br>
<h2>This is the footer.</h2>
<p>You can put stuff here.</p>
<br>

Included in the org mode file thus:

#+INCLUDE: "footer.html" html

It displays like this after HTML export, in the final HTML document:

<br> <h2>This is the footer.</h2> <p>You can put stuff here.</p> <br>

I am using org mode version 9.0.3.

Perhaps INCLUDE: is the wrong way to go about accomplishing this?

1 Answer 1

19

If you want to include literal HTML in your org file, and have it exported only when you export to HTML, use an export block:

#+BEGIN_EXPORT html
<br>
<h2>This is the footer.</h2>
<p>You can put stuff here.</p>
<br>
#+END_EXPORT

You cannot use #+INCLUDE inside an export block though (well, you can, but it won't work the way you expect - try it and see!)

[BTW, this assumes a recent version of org-mode. Earlier versions used #+BEGIN_HTML ... #+END_HTML instead.]

However, if you want to modify the footer, you cannot do it with an export block. For that, you have to customize the variable org-html-postamble. You should read the documentation of it with C-h v org-html-postamble RET.

1
  • 2
    Just a quick comment... the export block for html is bound to <h (expansible then with TAB)
    – Dox
    Aug 17, 2018 at 8:57

Your Answer

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

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