commit 7f17b29e0cf71eb6474d71673557616beafae60e
parent feb130d8cdef6f5a9ae364d27c3512337234f4ec
Author: Frederic Cambus <fred@statdns.com>
Date: Thu, 3 Mar 2016 23:23:43 +0100
Using a categoryURL variable to avoid accessing the category table every time
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/motyl.lua b/motyl.lua
@@ -126,12 +126,15 @@ status("Rendering index.html")
lfs.mkdir(data.site.destination .. "categories")
for category in pairs(data.site.categories) do
+ local categoryURL = data.site.categoryMap[category] .. "/"
+
table.sort(data.site.categories[category], sortDates)
+
data.page.title = category
data.site.posts = data.site.categories[category]
output = lustache:render(templates.archives, data, templates)
- lfs.mkdir(data.site.destination .. "categories/" .. data.site.categoryMap[category])
- writeFile(data.site.destination .. "categories/" .. data.site.categoryMap[category] .. "/index.html", output)
- status("Rendering " .. "categories/" .. data.site.categoryMap[category])
+ lfs.mkdir(data.site.destination .. "categories/" .. categoryURL)
+ writeFile(data.site.destination .. "categories/" .. categoryURL .. "index.html", output)
+ status("Rendering " .. categoryURL)
end