Hakyll
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
.
1teaserFieldWithSeparator "(.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.
1import qualified Data.Text as T
2
3...
4
5>>= replaceTeaserSeparator "(.MORE.)" "<!--more-->"
6
7...
8
9-- | Replace teaser separator in item.
10replaceTeaserSeparator :: String
11 -> String
12 -> Item String
13 -> Compiler (Item String)
14replaceTeaserSeparator tsFrom tsTo item = do
15 return $ fmap (replaceTeaserSeparatorWith tsFrom tsTo) item
16
17-- | Teaser separator in HTML
18replaceTeaserSeparatorWith :: String -- ^ teaser separator to replace
19 -> String -- ^ replacement teaser separator
20 -> String -- ^ HTML to replace in
21 -> String -- ^ Resulting HTML
22replaceTeaserSeparatorWith tsFrom tsTo html =
23 T.unpack $ T.replace tsFrom' tsTo' html'
24 where tsFrom' = T.pack tsFrom
25 tsTo' = T.pack tsTo
26 html' = T.pack html
Note: The teaser separator is actually lowercase but that gets replaced…