3.3 Where & How to Author Microformats

When one “publishes” an Org Export project, each file in the project is copied to the destination directory and perhaps transformed in the process (see Publishing in Org Mode, OrgMode) The publication operation is determined by the project’s :publishing-function configuration item, which defaults to org-html-publish-to-html. This function, in turn, invokes org-publish-org-to with the html back-end.

The details of the Org Export process are determined by the selected back-end (see Exporting in Org Mode, Org Mode). Of particular interest is the template member of each back-end’s translate-alist attribute– this shall be a lisp form that receives the abstract syntax tree for each Org Mode document published and is responsible for returning the text to be written to the output file (HTML, in our case)– this is where we emit our microformats.

This leaves us with a quandry: how shall we support different post types? One option would be to implement it in the template function: have the template extract the post-type document property, figure-out what sort of post we’re publishing, and emit the corresponding HTML.

Alternatively, we could implement it in the publication function– that is, have a different back-end for each post type. This is less convenient because you need to know the post type before the file is parsed (that is, all you’ve got at publication time is a filename).

So, let us define two Org Export projects, one for top-level pages on our site (home, about & so forth) and one for posts. The latter shall eventually support different post types.