When exporting and org file in emacs to either html or md for a jekyll-based web page, the yaml front matter gets twisted.

As suggested here, I have attempted enclosing it in an html block in the org file thus:

layout: post 
title:  "La redistritación"

It should output this:

layout: post 
title:  "La redistritación"

Using org-html-publish-to-html, I instead get this:

<div class="html">
layout: post 
title:  "La redistritación"

I also attempted enclosing in a source block (as suggested here) thus:

#+begin_src yaml
layout: post 
title:  "La redistritación"

which comes close, but prepends empty (code) spaces and is therefore not recognized as front matter by jekyll.

(And adding exports and results specs, as suggested here, returns a Wrong type argument: stringp, nil error message.)

How should I configure export settings to get proper yaml front matter?

  • 2
    Please do not post the same question on StackOverflow and emacs.SE - choose one or the other. Please delete one of these posts. Thx.
    – Drew
    Commented Feb 26, 2018 at 22:57
  • Upgrading org-mode seems to have taken care of the error message. It now exports front-matter that jekyll recognizes as such. But am still puzzled as to why the first approach will not work...
    – emagar
    Commented Feb 27, 2018 at 0:33
  • If you think the question and answer might help someone else then please post your answer as an actual answer (not a comment). You can accept your own answer. If you don't think the Q&A is likely to help someone else then consider deleting the question.
    – Drew
    Commented Feb 27, 2018 at 1:49

2 Answers 2


Don't see what version you are running but the solution is crazy simple. Mine didn't work at first (because i used yml not yaml) Those two file types are the same thing.

#+BEGIN_SRC yaml

Here is a filter to post-process the entire document body in order to expand expressions of the form {{{:ident}}} by resolving :ident against the communication channel. For example {{{:title}}} will be replaced by the document title as set by the #+title directive.

(defun my-org-body-filter (body backend info)
  (replace-regexp-in-string "{{{\\(:[^}]+\\)}}}"
                            (lambda (name)
                              (let* ((sym (intern (substring name 3 -3)))
                                     (val (plist-get info sym)))
                                (format "%s "(and val (car val)))))
(add-to-list 'org-export-filter-body-functions #'my-org-body-filter)

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.