Publishing Org-mode files to HTML

Table of Contents

Emacs is the best editor in the world.


Create your blog files and css files.

   |- css/
   |  `- worg.css
   |- img/

Publishing the org project

(require 'ox-publish)
(setq org-publish-project-alist
      '(;; Publish the posts
         :base-directory "~/blog/org"
         :base-extension "org"
         :publishing-directory "~/blog/public"
         :recursive t
         :publishing-function org-html-publish-to-html
         :headline-levels 4
         :section-numbers nil
         :with-author nil
         :with-creator nil
         :with-email nil
         :with-timestamps nil
         :auto-preamble t
         ; :auto-postamble nil
         :html-head "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/worg.css\"/>"
         :html-head-include-default-style nil
         ; :html-head-include-scripts nil
         ; :html-preamble nil
         ; :html-postamble nil
         :html-link-home "index.html"
         :html-link-up "sitemap.html"
         :html-metadata-timestamp-format "%Y-%m-%d %H:%M"
         :htmlized-source t
         :auto-sitemap t
         :sitemap-filename ""
         :sitemap-title "Sitemap"
         :author "xuchengpeng"
         :email ""

        ;; For static files that should remain untouched
         :base-directory "~/blog/org"
         :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|eot\\|svg\\|woff\\|woff2\\|ttf"
         :publishing-directory "~/blog/public"
         :recursive t
         :publishing-function org-publish-attachment

        ;; Combine the two previous components in a single one
        ("blog" :components ("blog-notes" "blog-static"))))

Then run org-publish-project to generate html files to ~/blog/public folder.

Date: 2019-12-28 Sat 23:03

Created: 2020-03-10 Tue 14:36