Because I have been wanting to use org-mode instead of Markdown for this site, I started using the Hakyll static site generator and converted all my content to org-mode. The Thomas Read’s blog (that I used as a template) even has MathJax support implemented. Support for \(\LaTeX\) is also possible with Hakyll, I read online.

GitHub

The source for this site is on GitHub: maridonkers / org.photonsphere.

org-mode

I had to add teaser support for org-mode because the <!--more--> that is used for Markdown is escaped by Pandoc in conversion from org-mode to HMTL. See site.hs on GitHub.

So teaserFieldWithSeparator is used instead of teaserField.

teaserFieldWithSeparator "(.MORE.)" "teaser" "content"

Note: The teaser separator is actually lowercase but that gets replaced…

And I’ve added a function replaceTeaserSeparator to replace the teaser separator with the regular HTML-comment version in the output.

import qualified Data.Text as T

...

>>= replaceTeaserSeparator "(.MORE.)" "<!--more-->"

...

-- | Replace teaser separator in item.
replaceTeaserSeparator :: String
                       -> String
                       -> Item String
                       -> Compiler (Item String)
replaceTeaserSeparator tsFrom tsTo item = do
    return $ fmap (replaceTeaserSeparatorWith tsFrom tsTo) item

-- | Teaser separator in HTML
replaceTeaserSeparatorWith :: String  -- ^ teaser separator to replace
                           -> String  -- ^ replacement teaser separator
                           -> String  -- ^ HTML to replace in
                           -> String  -- ^ Resulting HTML
replaceTeaserSeparatorWith tsFrom tsTo html =
    T.unpack $ T.replace tsFrom' tsTo' html'
    where tsFrom' = T.pack tsFrom
          tsTo' = T.pack tsTo
          html' = T.pack html

Note: The teaser separator is actually lowercase but that gets replaced…