main
 1-- Replaces any existing footer content with a consistent site footer
 2
 3footer_html = [[<p><a href="/">Vincent Demeester</a> · <a href="/flux/">flux</a> · <a href="/flux/feed.json">json</a> · <a href="/flux/feed.xml">atom</a> · <a href="/flux/content.xml" title="pages, TIL, bookmarks only">atom (content)</a></p>]]
 4
 5-- Find existing footer (org postamble or manual footer)
 6el = HTML.select_one(page, "#postamble")
 7if not el then
 8  el = HTML.select_one(page, "article footer")
 9end
10if not el then
11  el = HTML.select_one(page, "footer")
12end
13
14if el then
15  HTML.replace_content(el, HTML.parse(footer_html))
16  HTML.add_class(el, "site-footer")
17else
18  -- No footer — append one
19  container = HTML.select_one(page, "article")
20  if not container then
21    container = HTML.select_one(page, "body")
22  end
23  if container then
24    HTML.append_child(container, HTML.parse('<footer class="site-footer">' .. footer_html .. '</footer>'))
25  end
26end