return value_or_default("wiki.footer", "footer.html")
end
+ # Sidebar position.
+ #
+ # Position of the sidebar between `left`, `right` and `none`. Any other value
+ # will be considered as `none`.
+ #
+ # * key: `wiki.sidebar`
+ # * default: `left`
+ var sidebar: String is lazy do
+ return value_or_default("wiki.sidebar", "left")
+ end
+
# Directory used by rsync to upload wiki files.
#
# This information is used to update your distant wiki files (like the webserver).
article.breadcrumbs = new TplBreadcrumbs(self)
tpl_sidebar.blocks.add tpl_summary
article.sidebar = tpl_sidebar
+ article.sidebar_pos = wiki.config.sidebar
return article
end
# Sidebar of this article (if any).
var sidebar: nullable TplSidebar = null
+ # Position of the sidebar.
+ #
+ # See `WikiConfig::sidebar`.
+ var sidebar_pos: String = "left"
+
# Breadcrumbs from wiki root to this article.
var breadcrumbs: nullable TplBreadcrumbs = null
end
redef fun rendering do
- if sidebar != null then
- add "<div class=\"col-sm-3 sidebar\">"
- add sidebar.as(not null)
- add "</div>"
- add "<div class=\"col-sm-9 content\">"
- else
+ if sidebar_pos == "left" then render_sidebar
+ if sidebar == null then
add "<div class=\"col-sm-12 content\">"
+ else
+ add "<div class=\"col-sm-9 content\">"
end
if body != null then
add "<article>"
add " </article>"
end
add "</div>"
+ if sidebar_pos == "right" then render_sidebar
+ end
+
+ private fun render_sidebar do
+ if sidebar == null then return
+ add "<div class=\"col-sm-3 sidebar\">"
+ add sidebar.as(not null)
+ add "</div>"
end
end