org-export-before-processing-hook
So we can use this code to insert some front matter before exporting org file to HTML, specifically for Jekyll.
(defun get-org-buffer-title () "Get the title of the current org buffer from #+title." (with-current-buffer (current-buffer) (let ((ast (org-element-parse-buffer 'greater-element))) (org-element-map ast '(keyword) (lambda(kw) (plist-get (cadr kw) :value)) nil t)))) (defun add-post-frontmatter (backend) "BACKEND is the export back-end being used, as a symbol." (if (org-export-derived-backend-p backend 'html) (with-current-buffer (current-buffer) (goto-char (re-search-forward ":END:")) (insert (concat "\n#+begin_export html\n---\nlayout: post\ntitle: \"" (get-org-buffer-title) "\"\nexcerpt:\n---\n#+end_export\n"))))) (add-hook 'org-export-before-parsing-hook #'add-post-frontmatter)