Hackill says: "A dependency cycle has been detected: ..."

I am trying to build a website with 7 pages. Each page is defined using .markdown input. On each page I want a headline with links to all the other pages.

Now this seems impossible, since Hackill tells me that I have a recursive dependency.

[ERROR] Hakyll.Core.Runtime.chase: Dependency cycle detected: posts/page1.markdown depends on posts/page1.markdown

I have identified a recursive dependency on this fragment.

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

I think the problem is that I am not allowed to match the same template on which the download is being performed.

So, how can I build a context with listField for all messages that will be used when creating messages.

I suggest that an alternative would be to first create links, save them somehow, and then include them in the posts. But how would I do that?

+2
1

loadAll "posts/*", , .

:

match "posts/*" $ version "titleLine" $ do
  -- route
  -- compiler, maybe generate a link to real page here from file path

, :

match "posts/*" $ do
  -- route
  compile $ do
    postList <- loadAll ("posts/*" .&&. hasVersion "titleLine")
    -- render the page

, , URL- , - URL-. , .

, "titleLine", , , version .

+2

All Articles