0

I have an org file I am using to write a webpage. I write it in the org file, then export it to an HTML buffer with C-c C-e h H. This exports an entire html document, from the <?xml> declaration to the DOCTYPE to javascript and CSS, to a table of contents, to the ending </body></html>.

My problem is that I only want the org file to be a part of the final page; there is other static content I want there, and that content is controlled by a separate system. My workflow involves taking the org-exported-html and copying part of the resulting html into this second system. This is fine, but I have to manually find the part of the buffer where my content begins, and copy from there to the part of the buffer where my content ends.

Is there a way I can control the "extra" html content org puts into the buffer? It doesn't have to use the org export interface, although it is a convenient way of exporting.

2

It's possible exporting body-only "as is" using the following keys:

C-cC-eC-bhH

Note that the only thing it differs from your command is C-b before the formatting export options.

At least using Emacs 27.0.9 and the last org from melpa.

| improve this answer | |
  • 1
    Note also that this applies to any exporter, not just HTML. – NickD Apr 15 at 15:06
  • Very interesting! I wish there was a way to set it by default, but it doesn't look like it. – zck Apr 16 at 15:37
  • 1
    @zck I guess your could use either C-u to repeat the last export call, or making your own encapsulated command using org-export-as specifying your backend and options. – Muihlinn Apr 16 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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