2016-11-21 36 views
0

我刚刚开始与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 

我缺少什么?

回答

3

部分只能在模板中识别。您需要编译templateCompiler或使用applyAsTemplate。你可以在示例的index.html compilation中看到它。

applyAsTemplate时特别有用,你也想改变文字多一些,例如处理降价:

compile $ do 
    getResourceString 
     >>= applyAsTemplate someContext -- e.g. defaultContext 
     >>= renderPandoc 
     >>= loadAndApplyTemplate "templates/default.html" indexCtx 
     >>= relativizeUrls