ferron

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

commit 95fe41774b604fc3ad36efe2e9d6d9f96460452a
parent 8ecff3811073d54300fa579863914aa5b789ec37
Author: Hugo Soucy <hugo.soucy@equisoft.com>
Date:   Wed, 23 Oct 2019 06:25:51 -0400

Restablish shortlinks functions

Diffstat:
Mferron/init.lua | 3+++
Mferron/page.lua | 2+-
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/ferron/init.lua b/ferron/init.lua @@ -12,6 +12,7 @@ local lfs = require 'lfs' local config = require 'ferron.config' local site = require 'ferron.site' local content = require 'ferron.content' +local link = require 'ferron.link' local makepages = require('ferron.page').makepages local movestatic = require('ferron.static').init local plugin = require 'ferron.plugin' @@ -39,6 +40,8 @@ if arg[1] == 'build' then return tb.build{ makepages(site.setsite(sitename)), + link.makeshorts(), + link.makerewritemap(), movestatic() } end diff --git a/ferron/page.lua b/ferron/page.lua @@ -90,7 +90,7 @@ function page.render(page, sitedata) -- If exists set the shortlink if fl.isNotIndex(page) then shortlinks_db = fl.isFile(sitedata.data .. '/shortlinks.json') - shortlinks_db = fl.isFile(sitedata.data .. '/shortlinks.json') + shortlinks_tb = (shortlinks_db ~= false and json.decode(fl.pullfilecontent(shortlinks_db)) or nil) if shortlinks_tb and shortlinks_db then metaTable.shortlink = (shortlinks_tb[metaTable.rellink] and shortlinks_tb[metaTable.rellink] or nil)