ferron

Ferron is a fast and simple static website generator made with Lua.
Log | Files | Refs | Submodules | README | LICENSE

commit 066947a81af4e31113acbf6fcd40d50a2b3fa421
parent f7ee4ceff8f3c1ff72907ce4beb19a22bd6ee8be
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Sun, 26 Apr 2020 21:49:55 -0400

Convert makerewritemap as a plugin

Diffstat:
Mferron/link.lua | 26--------------------------
1 file changed, 0 insertions(+), 26 deletions(-)

diff --git a/ferron/link.lua b/ferron/link.lua @@ -48,30 +48,4 @@ function link.makeshorts() end end -function link.makerewritemap() - local links_db = site.data .. '/shortlinks.json' - local links_map = site.html .. '/shortlinksmap' - - if fl.isFile(links_db) then - local links = json.decode(fl.pullfilecontent(links_db)) - - if links then - -- Create an empty map file - fl.pushfilecontent(links_map, '') - - -- Open it - map, map_err = io.open(links_map, 'a') - - for k, v in pairs(links) do - -- location "/C" { block return 301 "https://$SERVER_NAME/C" } - -- map:write(v .. ' ' .. k, '\n') - map:write('location match ' .. '"^/' .. tostring(v) .. '$" { block return 301 "https://$SERVER_NAME' .. tostring(k), '"}\n') - end - - -- Close it when it's done - map:close() - end - end -end - return setmetatable(link, linkmeta)