diff --git a/wiki/frappe_wiki/doctype/wiki_document/wiki_document.py b/wiki/frappe_wiki/doctype/wiki_document/wiki_document.py index 5d5162d4..0fcd231a 100644 --- a/wiki/frappe_wiki/doctype/wiki_document/wiki_document.py +++ b/wiki/frappe_wiki/doctype/wiki_document/wiki_document.py @@ -322,6 +322,9 @@ def get_web_context(self) -> dict: # Render markdown and extract TOC headings in one pass rendered_content, toc_headings = render_markdown_with_toc(self.content or "") + # Ancestor nodes that should be expanded in the sidebar tree on initial render + expanded_nodes = set(self.get_ancestors()) if self.lft else set() + # Base context with defaults for orphan documents context = { "doc": self, @@ -335,6 +338,7 @@ def get_web_context(self) -> dict: "toc_headings": toc_headings, "raw_markdown": self.content or "", "nested_tree": [], + "expanded_nodes": expanded_nodes, "prev_doc": None, "next_doc": None, "edit_link": self.get_edit_link(), diff --git a/wiki/templates/wiki/document.html b/wiki/templates/wiki/document.html index 8ead2fff..cc43ce4d 100644 --- a/wiki/templates/wiki/document.html +++ b/wiki/templates/wiki/document.html @@ -13,7 +13,7 @@
-
diff --git a/wiki/templates/wiki/includes/header.html b/wiki/templates/wiki/includes/header.html index 74e448f6..01c6735d 100644 --- a/wiki/templates/wiki/includes/header.html +++ b/wiki/templates/wiki/includes/header.html @@ -61,7 +61,7 @@ {# Separator before toggle (only if there are text links) #} diff --git a/wiki/templates/wiki/includes/sidebar.html b/wiki/templates/wiki/includes/sidebar.html index 5850c55f..8b5b4d90 100644 --- a/wiki/templates/wiki/includes/sidebar.html +++ b/wiki/templates/wiki/includes/sidebar.html @@ -1,19 +1,19 @@ {% from "templates/wiki/macros/sidebar_tree.html" import render_wiki_tree %} {% from "templates/wiki/macros/buttons.html" import ghost_button_full, icon_button, render_icon %} -