satelito

Static [web] site (or page) generator (ssg) made with Lua script.
git clone git://soucy.cc/satelito.git
Log | Files | Refs | README

commit 6aa45a07b85d6eb6bec59eaf9160515e77c85387
parent 3fa6c3318a06541ef06e97e7e5df23fb5c3e6bf7
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Sun, 27 Feb 2022 20:39:25 -0500

Create pages from the pagination setup

Diffstat:
Msatelito/site.lua | 29+++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/satelito/site.lua b/satelito/site.lua @@ -41,23 +41,36 @@ function site.make(sitemap, templates, export, timestart) -- 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) + sitemap[i].pagination.limit = sitemap[i].pagination.limit or 6 + sitemap[i].pagination.prefix = sitemap[i].pagination.prefix or 'pg-' + + -- Split page children by pagination limit + paginated = list.set_pagination(sitemap[i].children, sitemap[i].pagination.limit) + -- Set the pagination length + sitemap[i].pagination.length = #paginated for p = 1, #paginated do - print(sitemap[i].title ..' PGE ' .. p) - --print(inspect(paginated[p])) sitemap[i].children = paginated[p] - - -- Make the page - html, html_path = page.make(sitemap[i], templates, sitemap[i].exportlink:match("(.*/)")..'pg'..p..'.html') - - -- Export the page + sitemap[i].pagination.current = p + -- Make the pagination pages + if p == 1 then + html, html_path = page.make(sitemap[i], templates) + else + html, html_path = page.make( + sitemap[i], + templates, + sitemap[i].exportlink:match("(.*/)")..sitemap[i].pagination.prefix..p..'.html' + ) + end + -- Export the pagination pages if export then file.export(html_path, html) else print(html) end end + + print(inspect(sitemap[i].pagination)) else -- Make the page html, html_path = page.make(sitemap[i], templates)