M plugins/section-link-highlight.lua => plugins/section-link-highlight.lua +7 -1
@@ 38,9 38,15 @@ while index do
-- Don't highlight the main page
-- That would also highlight all paths since they all have / in them
if href ~= "/" then
- if Regex.match(page_file, href) then
+ if Regex.match(page_file, Regex.replace_all(href, "/", "")) then
HTML.add_class(link, active_link_class)
end
end
+
+ -- Special handling for the blog, since it's at "/"
+ if (href == "/") and (page_file == "site/index.html") then
+ HTML.add_class(link, active_link_class)
+ end
+
index, link = next(links, index)
end
M soupault.conf => soupault.conf +8 -0
@@ 40,6 40,9 @@
[plugins.insert-if]
file = "plugins/insert-if.lua"
+[plugins.section-link-highlight]
+ file = "plugins/section-link-highlight.lua"
+
[widgets.asciinema-player-css]
widget = "insert-if"
html = "<link rel='stylesheet' type='text/css' href='/asciinema/asciinema-player.css' />"
@@ 52,6 55,11 @@
selector = "body"
check_selector = "asciinema-player"
+[widgets.highlight-active-link]
+ widget = "section-link-highlight"
+ selector = "nav"
+ active_link_class = "bold"
+
[widgets.vidpos-js]
widget = "insert-if"
html = "<script src='/js/vidpos.js' type='text/javascript'></script>"