I am generating a projects list on my blog. The data for the projects is in a data folder. Currently I use
{{ range sort $.Site.Data.projects “Id” “desc” }}
to iterate over all the projects and displaying them on /projects.
I want to add pagination. Looking at the Paginator documentation, something like this should work
{{ $paginator := .Paginate (sort $.Site.Data.projects “Id” “desc”) }}
{{ range .Paginator.Pages }}
I also tried
{{ $paginator := .Paginate (sort $.Site.Data.projects “Id” “desc”) }}
{{ range $paginator.Pages }}
but no luck either. Any ideas how to achieve this?
bep
December 23, 2015, 10:56am
2
The paginator only works for pages .
Bin95
September 27, 2017, 3:23pm
3
How did you solve this problem? Looking forward to hearing your alternative solutions for it @bep
I solved it using pages instead. I created a subfolder called projects in the content directory, added the projects there as pages and then made all the templates showing blog posts ignore this folder.
Bin95
September 28, 2017, 8:57am
5
@Igor_Kulman Thanks for your help:-) seems no other route to achieve what you mentioned on topic.
Hello @bep
Any news about that ? Does paginator still only works for pages !!! not for Data ??
Thanks
This topic was automatically closed after 26 hours. New replies are no longer allowed.