Discussion:
[hakyll] Using versions to break recursion
2piix
2017-07-09 17:19:56 UTC
Permalink
Hi, I am posting here because I am not sure where else to post my
question/report. (I posted on Github before finding this group -- sorry).


I am having a bit of a problem with "unexpected" behavior. I am working on
a site, and I have set up some matching routes like:

match "men/*" $ ...
match "women/*" $ ...

My intention is to have each women's article list all the men's articles
(like a table of context), and vice-versa. I understand that I can't
directly load the list of men's articles into the women's articles and
vice-versa at the same time, because of the recursion it creates.

To try to fix that, I set up some more routes:

match "men/*" $ version "item" $ ...
match "women/*" $ version "item" $ ...

so that the *real* (hasNoVersion) matches can be like:

match "men/*" $ do
route $ setExtension "html"
compile $ do
women <- loadAll $ "women/*" .&&. hasVersion "item"
...

match "women/*" $ do
route $ setExtension "html"
compile $ do
men <- loadAll $ "men/*" .&&. hasVersion "item"
...

Incidentally, I also set up an index.html:

match "index.html" $ do
route idRoute
compile $ do
men <- (loadAll $ ("gifts/men/*" .&&. hasNoVersion)) >>= recentFirst
women <- (loadAll $ ("gifts/women/*" .&&. hasNoVersion)) >>= recentFirst
...

However, the site is not working quite as I expect. When I load a women's
article in my browser, I see the hasNoVersion version. But when I load a
men's article, I see the item version. What is responsible for this
non-symmetric situation? (I mean, presumably it's due to the order in which
the compiler is compiling the hasNoVersion and item versions being
different for men and women). How can I fix it?
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...