diff --git a/src/pydata_sphinx_theme/__init__.py b/src/pydata_sphinx_theme/__init__.py index e62379b01..48220d231 100644 --- a/src/pydata_sphinx_theme/__init__.py +++ b/src/pydata_sphinx_theme/__init__.py @@ -247,9 +247,14 @@ def generate_header_nav_html(n_links_before_dropdown=5): meth = "findall" if hasattr(root, "findall") else "traverse" for toc in getattr(root, meth)(toctree_node): for title, page in toc.attributes["entries"]: + # if the page is using "self" use the correct link + page = toc.attributes["parent"] if page == "self" else page + # If this is the active ancestor page, add a class so we highlight it current = " current active" if page == active_header_page else "" title = title if title else app.env.titles[page].astext() + + # create the html output links_html.append( f"""