Re: [hakyll] Pagentation possible?

140 views
Skip to first unread message

Ian Ross

unread,
Feb 9, 2013, 2:29:14 AM2/9/13
to hak...@googlegroups.com
I did this for Hakyll 3 (blog at http://www.skybluetrades.net/blog, source at https://github.com/ian-ross/blog), but I've not yet upgraded to Hakyll 4.  I know for certain that my approach won't work with Hakyll 4 (it used metacompilers), but there might be something of use in there.


On 9 February 2013 02:12, James McGlashan <arche...@gmail.com> wrote:
How could one pagentate their posts? I.e index.html showing 10 *POSTS* and not just links to them.. Then having (first page) (previous page)/(Next page) (last page) etc..

As for the archive.html, this could do similar except only show what it is already but have say 30 posts.

Could anyone here help me with how I could have this?

--
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+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Ian Ross   Tel: +43(0)6804451378   i...@skybluetrades.net   www.skybluetrades.net

Jasper Van der Jeugt

unread,
Feb 10, 2013, 6:01:14 AM2/10/13
to hak...@googlegroups.com
Hello,

The general way to accomplish this is:

- Use `getMatches :: MonadMetadata m => Pattern -> m [Identifier]` to
get a list of posts anywhere
- Optionally order them using their metadata, using: `getMetadata ::
MonadMetadata m => Identifier -> m Metadata`

Both `Compiler` and `Rules` have a `MonadMetadata` instance, so you
can do this anywhere. `Rules` is preferable because it won't need
recomputation, but you'll have to use `rulesExtraDependencies` in this
case.

Let me know if you need more detailed information.

Hope this helps,
Peace,
Jasper

James McGlashan

unread,
Feb 11, 2013, 1:38:37 AM2/11/13
to hak...@googlegroups.com
More details please. :) IRC maybe? Cheers. Thanks for helping. Great project you have here :D

Daniel Mlot

unread,
Feb 13, 2013, 1:36:31 PM2/13/13
to hak...@googlegroups.com
I implemented a pagination scheme with Hakyll 4, though I don't know how much it can help (the code is still a little obtuse, and I haven't published the data files yet). The generated pages are the news archives listed at the end of [1], plus the home page news, which are just the set of non-archived news posts. The literate source is at [2] - look for the section starting with a `match "news/*"` (i.e., the markdown-written news posts), from line 399 of the raw source onwards. Note that I do not use a set time span or number of posts for introducing page breaks. Rather, I place them manually by defining a metadata field called `boundary` in a news post whenever I want it to start a new page.

[1] http://scr.stunts.hu/archives/static-index.html
[2] http://scr.stunts.hu/hakyll.html
Reply all
Reply to author
Forward
0 new messages