org-site: static site generator based on Emacs Org-mode
This project has been stopped as an experimentation to write a static site generator with Emacs Lisp. But still, I’ll keep the code here, just for demo.
I’ve found it’s not convenient to write such a thing with Emacs Lisp since I
have to do a lot of hack such as
with-temp-buffer, etc to
match out necessary part from org-mode files.
If you still want a org-mode elisp-based solution, then org-page may be the only choice.
It’s not designed to be a so-called static blog generator, however, org-site will support some simple wiki-like site generation.
Features of org-site:
- A convenient workflow without leaving Emacs
- Flexible template and theme design, with a default twitter bootstrap theme
- Automatic index page generation
- Commenting using disqus
- Easily switching between multiple org-site projects
Org-site depends on some extra elisp libraries, to install these dependencies,
I recommend you install el-get first, and then evaluate the following elisp
code snippet in
*scratch* buffer by typing
C-x C-e or
(let ((el-get-sources)) (add-to-list 'el-get-sources '(:name org-site :type github :depends (mustache) :pkgname "xiaohanyu/org-site")) (el-get 'sync (mapcar 'el-get-source-name el-get-sources)) (require 'org-site))
That’s all, now let’s create our first org-site.
Org-site provides following shortcut commands to facilitate your workflow:
org-site-new-project: create a new org-site project.
org-site-load-project: load an existing org-site project and set it to the current org-site project.
org-site-new-post: create a new post page.
org-site-new-wiki: create a new wiki page.
org-site-publish: publish org-site to html site, other formats like pdf will be supported in future.
The basic workflow is
org-site-new-wiki, and then finally
The basic directory structure of org-site project
org-site-new-project, you will get the following directory structure:
about.org # about page of your site index.org # index page of your site org-site-config.el # org-site project config file post # post directory wiki # wiki directory
org-site-config.el, you should set your basic information about your site,
such as site url, site title, author name and email, disqus url/identifier,
There’re two types of page in
org-site, post and wiki. Generally, posts are
updated one by one, while wikis are updated little by little. Later version of
org-site will add some more flexible feature support and differentiation to
these two different pages, but currently
org-site treat them different but
handle them the same.
Things about code
org-site is based heavily on
org-mode, especially on
org-site do some monkey patching to
org-export-as-* to support
mustache template rendering, thus provide a
flexible theme and customization support.
Preview your org-site in localhost
If you want to publish your org-site to public, you must set
your real site url, see
https://github.com/xiaohanyu/org-site/blob/gh-sources/org-site-config.el for a
If you just want to preview your org-site in localhost, you can set
org-site-url to “localhost”, then use things like
SimpleHTTPServer to provide a simple http localhost site.
- Emacs: Of course it needs Emacs
- Org mode: Another of course
- mustache.el: org-site use mustache as its template render engine.
mustache.el depends following libs, so:
- ht.el: The missing hash table utility library for Emacs.
- loop.el: friendly imperative loop structures for Emacs lisp
- s.el: The long lost Emacs string manipulation library.
- dash.el: A modern list library for Emacs. This is required by
mustache.el, not by
- Add exportable pdf support
- RSS export
- Customizable TOC(Table of Contents)
- Org-mode code weave/tangle to support literate programming
- A copiable, collapsible code block
- Configurable org html source
- Some more theme?
- Site statistics, gravatar, etc.
- Post Category/Tag support
- Math/TeX/MathJax test and support
- Localhost/Production support?
- Search engine support
- Add an impressive(I hope that) github page generated by
- Documentation work.
- TDD support based on elisp ERT?