2
我正在尝试构建一个包含7个页面的站点。每个页面都使用.markdown输入定义。在每个页面上,我想要一个包含所有其他页面链接的标题。Hakyll说:“检测到依赖周期:...”
现在,这似乎是不可能的,因为Hakyll告诉我,我有一个递归依赖项。
[ERROR] Hakyll.Core.Runtime.chase: Dependency cycle detected: posts/page1.markdown depends on posts/page1.markdown
我已经确定了这个片段的递归依赖关系。
match "posts/*" $ do
route $ setExtension "html"
compile $ do
posts <- loadAll "posts/*"
let indexCtx =
listField "posts" postCtx (return posts) `mappend`
constField "title" "Home" `mappend`
defaultContext
pandocCompiler >>= loadAndApplyTemplate "templates/post.html" indexCtx
>>= loadAndApplyTemplate "templates/default.html" indexCtx
>>= relativizeUrls
我想问题是,我不允许在相同的模板上匹配做一个负载。
那么如何构建一个listField的上下文,以便在生成帖子时使用所有帖子。
我想一个替代方法是首先生成链接,以某种方式存储它们,然后将它们包含在帖子中。但我该怎么做?
它应该可能是hasVersion而不是setVersion,对吧? – nesqi
@nesqi抱歉,修正。 – zakyggaps
鉴于“titleLine”版本使用相同的路由,URL将是正确的。 – nesqi