HiD::Pager - Class for paging thru sets of entries
To use pagination with just the blog pages, set the following config options: pagination: entries: 10 page: 'blog/%{page}s' template: 'blog/index.html' C<pagination.entries> sets the number of entries per page. C<pagination.page> sets the pattern for pages. C<pagination.template> is the template file that will be used for each file in turn. A C<index.html> will be appended to each page. Note that no 'page1' entry will be generated; in the example above, the first page would be at 'blog/index.html', the second at 'blog/page2/index.html', and so on. If you need more control, or want to use pagination inside a L<HiD::Generator>, you can instatiate one like so: my $pager = HiD::Pager->new({ entries => $site->posts , entries_per_page => 5 , hid => $site , page_pattern => 'blog/%{page}s' , }); while( my $page_data = $pager->next() ) { my $page = HiD::Page->new( metadata => { page_data => $page_data }, # other page data here ); # inject page into site, etc. } # in page template, assuming Kolon template syntax : for $page_data.posts -> $post { : ## render page here : } : # other useful info for creating intra-page links and metadata : $page_data.current_page_url = url of current page : $page_data.page_number = number of current page : $page_data.total_pages = total number of pages : $page_data.prev_page = number of previous page (undef if no previous) : $page_data.prev_page_url = url of previous page (undef if no previous) : $page_data.next_page = number of next page (undef if no next) : $page_data.next_page_url = url of next page (undef if no next)
Class providing pagination services for sets of posts. Can be used for main blog post pages by setting up the appropriate configuration, or used inside a HiD::Generator class to provide paged sets of a subset of the posts on a site.
HiD::Generator
Array of HiD::Post objects being worked with
Number of entries per page.
All hail the God Object.
Regex used to generate per-page URLs
The Data::Page object that does all the work.
Returns the URL for the current page in the set.
Returns the data structure for the pager information.
Returns the URL for the next page in the set.
Returns the URL for the previous page in the set.
version 1.992
John SJ Anderson <genehack@genehack.org>
This software is copyright (c) 2015 by John SJ Anderson.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install HiD, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HiD
CPAN shell
perl -MCPAN -e shell install HiD
For more information on module installation, please visit the detailed CPAN module installation guide.