Reputation: 1575
I currently write my posts in emacs org-mode and then have org-mode export to markdown. Then Hakyll turns that markdown into HTML.
That works OK but I would like finer-grained control of the HTML that gets posted. What I would rather do is have org-mode export to HTML and then have Hakyll use that HTML as input.
Note: my blog is working fine with markdown input, I just want to use (org-mode generated) HTML as input instead.
Hakyll's opening page says "WRITE YOUR CONTENT IN WHATEVER FORMAT YOU PREFER" so HTML input does work (I tried it somewhat successfully).
Hakyll's
FAQ
says to use getResourceBody
instead of pandocCompiler
when inputting HTML.
What I haven't figured out yet is how to handle title, tags and teasers when using HTML as input.
A typical markdown post would be
---
title: Switching to Hakyll
tags: hakyll, haskell, pandoc, emacs, org-mode, markdown
---
I chose [Hakyll](http://jaspervdj.be/hakyll/) for blog software ...
<!-- MORE -->
I write posts in [Emacs](https://en.wikipedia.org/wiki/Emacs) ...
QUESTIONS:
what code do I use to process the title/tags?
where/how do I put/format the "teaser" marker in the HTML input?
Examples would be great, or at least pointers to relevant doc.
UPDATE
As suggested by @duplode, when I replace pandocCompiler
with getResourceBody
it handles the content and the teaser correctly. But the tags are not seen. They just end up in the HTML output.
The HTML input is like:
.
.
.
</head>
<body>
<div id="content">
<h1 class="title">2013-06-30-test-post</h1>
---
title: My first org-mode post
tags: emacs, org-mode
---
<p>
Does it work?
</p>
<!-- MORE -->
<p>
This is the rest.
</p>
Upvotes: 3
Views: 560
Reputation: 1579
If you wish to use your HTML as a template, you should probably take a look at applyAsTemplate
You can also take a look at my blog's source code for examples.
Upvotes: 0
Reputation: 34378
It should work exactly in the same way. The metadata header (i.e. the block between the ---
) is specific to Hakyll, and not tied to markdown syntax. The same goes for the other functionality. When you replace pandocCompiler
with getResourceBody
, the only effect is to skip the pandoc markup conversion step, and so nothing else in the processing needs to change.
Upvotes: 2