From 04df8a3e57789af37d9455aac174bdcec8513553 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Thu, 4 Aug 2022 21:48:03 +0200 Subject: Don't generate randomized pages list --- scripts/metadata.lua | 4 ++-- scripts/page.lua | 20 +++++++++----------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/scripts/metadata.lua b/scripts/metadata.lua index 5d372fc..42bf71c 100644 --- a/scripts/metadata.lua +++ b/scripts/metadata.lua @@ -84,12 +84,12 @@ function process_pages(meta) pages_all:sort(sort.page_sort(meta.list_order, meta.pages)) pages_date_desc:sort(sort.page_sort("date_desc", meta.pages)) - local pages_random = pages_all:clone():shuffle() + --local pages_random = pages_all:clone():shuffle() meta.pages = { all = pages_all, date_desc = pages_date_desc, - random = pages_random, + --random = pages_random, by_id = meta.pages } end diff --git a/scripts/page.lua b/scripts/page.lua index fd12230..1ce060e 100644 --- a/scripts/page.lua +++ b/scripts/page.lua @@ -4,12 +4,8 @@ local common = require 'scripts.lib.common' local sort = require 'scripts.lib.sort' function resolve_url(site_url, ref_file, target_file) - site_url = utils.stringify(site_url) - ref_file = utils.stringify(ref_file) - target_file = utils.stringify(target_file):gsub("/index%.html$", "/") - local ref_base_dir = path.directory(ref_file) - local abs = target_file + local abs = target_file:gsub("/index%.html$", "/") local rel = path.make_relative(abs, ref_base_dir, true) local full = (abs:sub(1, 1) == "/" and (site_url .. abs)) or abs @@ -142,7 +138,7 @@ end function process_pages(meta) meta.pages.all = meta.pages.all:filterMap(deref_page(meta.pages.by_id)) meta.pages.date_desc = meta.pages.date_desc:filterMap(deref_page(meta.pages.by_id)) - -- meta.pages.random = meta.pages.random:filterMap(deref_page(meta.pages.by_id)) + --meta.pages.random = meta.pages.random:filterMap(deref_page(meta.pages.by_id)) end function resolve_urls(global, build, meta) @@ -190,11 +186,9 @@ function process(global, build, meta, dir) process_pages(meta) - meta.list = generate_list(meta) - - -- if dir <= 0 and meta.parent then - -- process(global, build, meta.parent, -1) - -- end + if dir <= 0 and meta.parent then + process(global, build, meta.parent, -1) + end end function Meta(meta) @@ -215,6 +209,8 @@ function Meta(meta) menus = meta.menus } + global.site.url = utils.stringify(global.site.url) + meta = meta.tree local parts = utils.stringify(build.namespace):split('/'):skip(1) @@ -228,6 +224,8 @@ function Meta(meta) process(global, build, meta, 0) + meta.list = generate_list(meta) + if global.menus and global.menus.main then global.menus.main = prep_menu(meta.namespace.full, global.menus.main) end -- cgit v1.2.3-70-g09d2