如何使用markdown中的偏好?
问题描述:
我刚刚开始与Hakyll,并与默认网站hakyll init
一起工作。我试图把在2015-08-12.spqr.markdown
如下:如何使用markdown中的偏好?
$partial("includes/DB.hs")$
如预期它没有工作 - 后刚刚出现的文字文本$partial("includes/DB.hs")$
。它并未将includes/DB.hs
的内容纳入该帖子。然后我试图加入以下site.hs
,但即使这样没有工作:
match "includes/*" $ compile templateBodyCompiler
我缺少什么?
答
部分只能在模板中识别。您需要编译templateCompiler
或使用applyAsTemplate
。你可以在示例的index.html
compilation中看到它。
applyAsTemplate
时特别有用,你也想改变文字多一些,例如处理降价:
compile $ do
getResourceString
>>= applyAsTemplate someContext -- e.g. defaultContext
>>= renderPandoc
>>= loadAndApplyTemplate "templates/default.html" indexCtx
>>= relativizeUrls