commit e3aecc41ff443c75823b2a18cb3261217513fee4
parent d2b112697fcf0c75397a7a84e7b22285864ec27d
Author: Hugo Soucy <hugo@soucy.cc>
Date: Sun, 27 Nov 2022 11:26:10 -0500
Rename sitemap to sitedata
Diffstat:
1 file changed, 28 insertions(+), 26 deletions(-)
diff --git a/satelito/site.lua b/satelito/site.lua
@@ -29,58 +29,60 @@ function site.get_config(filepath)
return site.get_config(dir_parent)
end
--- Make the site (from the sitemap)
-function site.make(sitemap, export, timestart)
+-- Make the site (from the sitedata)
+function site.make(sitedata)
local duration
+ local export = _G.Satelito.args['export']
+ local timestart = _G.Satelito.timestart
- for i = 1, #sitemap do
+ for i = 1, #sitedata do
local html, html_path
local feed_xml, feed_xml_path
local paginated
- sitemap[i].index = i
+ sitedata[i].index = i
- if sitemap[i].list ~= false and file.is_index(sitemap[i].path) then
- sitemap[i].children = list.get_children(sitemap[i].list, sitemap, sitemap[i].asc)
+ if sitedata[i].list ~= false and file.is_index(sitedata[i].path) then
+ sitedata[i].children = list.get_children(sitedata[i].list, sitedata, sitedata[i].asc)
end
- if sitemap[i].collection then
- sitemap[i].collection = list.get_collection(sitemap[i].collection, sitemap, sitemap[i].asc)
+ if sitedata[i].collection then
+ sitedata[i].collection = list.get_collection(sitedata[i].collection, sitedata, sitedata[i].asc)
end
if i > 1 then
- sitemap[i].relprev = sitemap[i-1]
+ sitedata[i].relprev = sitedata[i-1]
end
- if i < #sitemap then
- sitemap[i].relnext = sitemap[i+1]
+ if i < #sitedata then
+ sitedata[i].relnext = sitedata[i+1]
end
-- If a pagination is requested
- if sitemap[i].pagination and file.is_index(sitemap[i].relpath) then
+ if sitedata[i].pagination and file.is_index(sitedata[i].relpath) then
print('=> A pagination is requested ...')
- sitemap[i].pagination.limit = sitemap[i].pagination.limit or 6
- sitemap[i].pagination.prefix = sitemap[i].pagination.prefix or 'pg-'
+ sitedata[i].pagination.limit = sitedata[i].pagination.limit or 6
+ sitedata[i].pagination.prefix = sitedata[i].pagination.prefix or 'pg-'
-- Split page children by pagination limit
- paginated = list.set_pagination(sitemap[i].collection or sitemap[i].children, sitemap[i].pagination.limit)
+ paginated = list.set_pagination(sitedata[i].collection or sitedata[i].children, sitedata[i].pagination.limit)
-- Set the pagination length
- sitemap[i].pagination.length = #paginated
+ sitedata[i].pagination.length = #paginated
print('=> Making the pagination pages ...')
for p = 1, #paginated do
- sitemap[i].children = paginated[p]
- sitemap[i].pagination.current = p
+ sitedata[i].children = paginated[p]
+ sitedata[i].pagination.current = p
-- Make the pagination pages
if p == 1 then
- html, html_path = page.make(sitemap[i])
+ html, html_path = page.make(sitedata[i])
else
html, html_path = page.make(
- sitemap[i],
- sitemap[i].exportlink:match("(.*/)")..sitemap[i].pagination.prefix..p..'.html'
+ sitedata[i],
+ sitedata[i].exportlink:match("(.*/)")..sitedata[i].pagination.prefix..p..'.html'
)
end
-- Export the pagination pages
@@ -93,7 +95,7 @@ function site.make(sitemap, export, timestart)
else
-- Make the page
- html, html_path = page.make(sitemap[i])
+ html, html_path = page.make(sitedata[i])
-- Export the page
if export then
@@ -104,14 +106,14 @@ function site.make(sitemap, export, timestart)
end
-- Feed
- if file.is_index(sitemap[i].relpath) and export then
- feed_xml, feed_xml_path = feed.make(sitemap[i])
+ if file.is_index(sitedata[i].relpath) and export then
+ feed_xml, feed_xml_path = feed.make(sitedata[i])
file.export(feed_xml_path, feed_xml)
end
-- Copy assets to the public_html/ folder
if export then
- assets.export(sitemap[i])
+ assets.export(sitedata[i])
end
end
@@ -120,7 +122,7 @@ function site.make(sitemap, export, timestart)
or 'in less than 1 second.'
print('--------------------------------------------------------------------------')
- print('Satelito built '..lume.count(sitemap)..' HTML page(s) '..duration)
+ print('Satelito built '..lume.count(sitedata)..' HTML page(s) '..duration)
end
return site