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?

thnx-236659
  • 495
  • 5
  • 8

1 Answers1

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.

NickD
  • 27,023
  • 3
  • 23
  • 42