How to omit h1 title heading in HTML export

How to omit h1 title heading in HTML export

Introduce how to omit h1 title in the exported html.

Sometimes it would be better to omit h1 title in exported HTML, and there is an email discussing it. It is suggested to add customized filters to do this:

(defun rasmus/org-html-ignore-title-if-present (string backend info)
  "Strip title if it's already there for html."
  (when (and (org-export-derived-backend-p backend 'html)
             (string-match "h1 class=\"title\"" string))
    (replace-regexp-in-string "<h1 class=\"title\">.*?</h1>" "" string)))

(add-to-list 'org-export-filter-final-output-functions
             'rasmus/org-html-ignore-title-if-present)

That's it!


Author: YangYingchao
posted @ 2013-10-30 14:22  英超  Views(317)  Comments(0Edit  收藏  举报