commit 57e8579902dfec2f5f2fc9fac3b5d5eb68d343c9
parent d2115f3845f49eeed2fa5aa515dd1bfc0e4925d4
Author: Hugo Soucy <hugo@soucy.cc>
Date: Wed, 24 Nov 2021 22:11:00 -0500
Progress with the pagination functionality. The split worked.
But it's not sorted right for now.
Diffstat:
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/satelito/site.lua b/satelito/site.lua
@@ -9,6 +9,7 @@ local file = require 'satelito.file'
local list = require 'satelito.list'
local lume = require 'satelito.lib.lume.lume'
local page = require 'satelito.page'
+local inspect = require 'inspect'
--- From a filepath get the closest 'config.lua' by climbing the
-- directory tree
@@ -33,11 +34,22 @@ function site.make(sitemap, templates, export, timestart)
for i = 1, #sitemap do
local html, html_path
local feed_xml, feed_xml_path
+ local paginated
- --sitemap[i].root = sitemap
sitemap[i].children = list.get_children(sitemap[i].list, sitemap, sitemap[i].asc)
sitemap[i].collection = list.get_collection(sitemap[i].collection, sitemap, sitemap[i].asc)
+ -- If a pagination is requested
+ if sitemap[i].pagination and file.is_index(sitemap[i].relpath) then
+ paginated = list.set_pagination(sitemap[i].children, sitemap[i].pagination)
+
+ for p = 1, #paginated do
+ print('PGE ' .. p)
+ --print(inspect(paginated[p]))
+ sitemap[i].children = paginated[p]
+ end
+ end
+
-- Make the page
html, html_path = page.make(sitemap[i], templates)