commit 44f3b0b92cbd1b4dfb18da15b3b6b6716794d1bd
parent 682a6b7dc41dcebb5717e0056c861c3aaabb354e
Author: Hugo Soucy <hsoucy@kronostechnologies.com>
Date: Thu, 9 Aug 2018 12:57:08 -0400
Add a new fonction to the site module.
Diffstat:
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/ferron/site.lua b/ferron/site.lua
@@ -20,6 +20,21 @@ function site.listsites()
return sites_arr
end
+function site.getsiteinfos(sitename)
+ local site = path.isdir(config.paths.sites .. "/" .. sitename)
+ local site_config, site_err = fileutils.loadlocalconfig(site .. "/site-config.lua")
+ local site_infos = {}
+
+ -- Create a table with the basic infos of the site
+ site_infos = {
+ path = site,
+ siteconfig = site_config["siteconfig"],
+ pagestable = {},
+ }
+
+ return site_infos
+end
+
function site.getsites()
local sites_tb = {}
local sites_arr = {}
@@ -63,6 +78,8 @@ function site.setsite()
whichsite=io.read()
until (tableutils.haskey(sites_arr, tonumber(whichsite))) == true
+ site.getsiteinfos("hugosoucycc")
+
Ferron.site = sites_tb[sites_arr[tonumber(whichsite)]]
Ferron.site.siteconfig.baseurl = (Ferron.devmode == true and Ferron.site.siteconfig.urldev or Ferron.site.siteconfig.url)
Ferron.site.siteconfig.prefetchlist = {}