diff --git a/src/devdocs2zim/client.py b/src/devdocs2zim/client.py index 44e0085..d7924c5 100644 --- a/src/devdocs2zim/client.py +++ b/src/devdocs2zim/client.py @@ -148,8 +148,15 @@ def count(self) -> int: def _contained_pages(self) -> set[str]: return {link.path_without_fragment for link in self.links} - def contains_page(self, page_path: str) -> bool: - """Returns whether this section contains the given page.""" + def opens_for_page(self, page_path: str) -> bool: + """Returns whether this section should be rendered open for the given page.""" + + # Some docs like Lua or CoffeeScript have all of their content in the index. + # Others like RequireJS are split between index and additional pages. + # We don't want sections opening when the user navigates to the index. + if page_path == "index": + return False + return page_path in self._contained_pages diff --git a/src/devdocs2zim/templates/page.html b/src/devdocs2zim/templates/page.html index 887f7c7..72c0bba 100644 --- a/src/devdocs2zim/templates/page.html +++ b/src/devdocs2zim/templates/page.html @@ -29,7 +29,7 @@ {{devdocs_metadata.name}}