summaryrefslogtreecommitdiffstats
path: root/plugins/archives-index.lua
blob: aceb7a9fbef6b32d07969fceb6ccdb7bf279e209 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
env = {}

container = HTML.select_one(page, config["index_selector"])
container_content = HTML.inner_html(container)

if Value.is_string(container_content) then
  container_content = String.to_number(container_content)
end

template = nil

if container_content then
  env['contents'] = Table.take(site_index, container_content)
  template = "index_short_template_file"
else
  env['contents'] = site_index
  template = "index_full_template_file"
end

template = Sys.read_file(config[template])
rendered_entries = HTML.parse(String.render_template(template, env))
HTML.replace_content(container, rendered_entries)