Skip to content

fix: add home section #769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
bfe36b5
fix: add home section
Revathyvenugopal162 Aug 1, 2025
432099c
chore: adding changelog file 769.fixed.md [dependabot-skip]
pyansys-ci-bot Aug 5, 2025
dd419c4
Merge branch 'main' into feat/home-section
Revathyvenugopal162 Aug 5, 2025
7c28eb2
fix: update the precommit
Revathyvenugopal162 Aug 5, 2025
9505bb2
Merge branch 'feat/home-section' of https://github.com/ansys/ansys-sp…
Revathyvenugopal162 Aug 5, 2025
667e260
fix: add docstree resolve
Revathyvenugopal162 Aug 5, 2025
9329a63
fix: add docstree resolve
Revathyvenugopal162 Aug 5, 2025
b92a0ee
fix: remove html context
Revathyvenugopal162 Aug 5, 2025
b70964e
fix: cleanup the docresolve
Revathyvenugopal162 Aug 6, 2025
51c4aa3
fix: strict logo link
Revathyvenugopal162 Aug 6, 2025
7fb8c85
fix: precommit
Revathyvenugopal162 Aug 6, 2025
a7bd29c
Merge branch 'main' into feat/home-section
Revathyvenugopal162 Aug 6, 2025
dddae72
fix: update any
Revathyvenugopal162 Aug 6, 2025
5cc571b
fix: update the check
Revathyvenugopal162 Aug 6, 2025
ec08c2c
fix: update pre-commit
Revathyvenugopal162 Aug 6, 2025
15a45e6
Merge branch 'main' into feat/home-section
Revathyvenugopal162 Aug 12, 2025
e458be1
chore: adding changelog file 769.fixed.md [dependabot-skip]
pyansys-ci-bot Aug 12, 2025
5ae077c
Merge branch 'main' into feat/home-section
Revathyvenugopal162 Aug 13, 2025
ed462df
feat: add tooltip
Revathyvenugopal162 Aug 14, 2025
918dacb
fix: codestyle
Revathyvenugopal162 Aug 14, 2025
945e5a6
fix: depedencies
Revathyvenugopal162 Aug 14, 2025
b504bf9
Merge branch 'main' into feat/home-section
Revathyvenugopal162 Aug 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/769.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add home section
52 changes: 46 additions & 6 deletions src/ansys_sphinx_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@

import os
import pathlib
from typing import Any, Dict
import warnings
from typing import Any

from docutils import nodes
from pydata_sphinx_theme.toctree import traverse_or_findall
from sphinx import addnodes
from sphinx.addnodes import toctree
from sphinx.application import Sphinx
from sphinx.util import logging

Expand Down Expand Up @@ -290,7 +291,7 @@ def fix_edit_link_page(link: str) -> str:


def update_footer_theme(
app: Sphinx, pagename: str, templatename: str, context: Dict[str, Any], doctree: nodes.document
app: Sphinx, pagename: str, templatename: str, context: dict[str, Any], doctree: nodes.document
) -> None:
"""Update the version number of the Ansys Sphinx theme in the footer.

Expand Down Expand Up @@ -380,10 +381,12 @@ def configure_theme_logo(app: Sphinx):

if logo_option == "ansys":
theme_options["logo"] = ansys_logo
theme_options["logo_link"] = theme_options.get("logo_link", ANSYS_LOGO_LINK)
# Ansys logo should link to the ANSYS homepage
theme_options["logo_link"] = ANSYS_LOGO_LINK
elif logo_option == "pyansys":
theme_options["logo"] = pyansys_logo
theme_options["logo_link"] = theme_options.get("logo_link", PYANSYS_LOGO_LINK)
# PyAnsys logo should link to the PyAnsys Meta documentation
theme_options["logo_link"] = PYANSYS_LOGO_LINK
elif logo_option == "no_logo":
theme_options["logo"] = None

Expand Down Expand Up @@ -474,7 +477,43 @@ def update_search_sidebar_context(
context["sidebars"] = sidebar


def setup(app: Sphinx) -> Dict:
def on_doctree_resolved(app: Sphinx, doctree: nodes.document, docname: str) -> None:
"""Add a 'Package Home' entry to the root TOC.

Parameters
----------
app : Sphinx
Sphinx application instance for rendering the documentation.
doctree : nodes.document
Document tree for the page.
docname : str
Name of the current document.

Notes
-----
This function checks if the 'Package Home' entry already exists in the root TOC.
If it does not exist, it adds the 'Package Home' entry at the beginning of the TOC.
The 'Package Home' entry links to the index page of the documentation.
"""
index_page = "index"
root_toc = app.env.tocs[app.config.root_doc]
for toc in traverse_or_findall(root_toc, toctree):
if not toc.attributes.get("entries"):
return

for title, page in toc.attributes["entries"]:
if title == "Package Home":
return

home_entry = (
nodes.Text("Package Home"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we imposing this to always be Package Home? I thought we agreed on just writing Home here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mia suggested having the package at home in this comment last week, but we can discuss this further.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.. "Package Home" looks too verbose and weird .. I'd sugggest moving to "Home"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like Package Home is too long.. Home is consistent with the logo 🏠 we see in the breadcrumps. To me @mia-guo-ux didn't mean Package in the label.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pinging @mia-guo-ux here , for insights

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@germa89 @Revathyvenugopal162

To avoid confusion, we initially adopted the term Package Home, since Home alone could be misinterpreted as referring to the broader PyAnsys home.

One potential improvement would be to simplify the label to just Home, while providing additional context through a tooltip. For example, hovering over "Home" could display a tooltip like PyAEDT Home, clearly indicating the specific package being referenced.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the tool tip, and renamed to home

index_page if index_page != docname else None,
)
# Insert 'Package Home' entry at the beginning of the TOC
toc.attributes["entries"].insert(0, home_entry)


def setup(app: Sphinx) -> dict:
"""Connect to the Sphinx theme app.

Parameters
Expand Down Expand Up @@ -522,6 +561,7 @@ def setup(app: Sphinx) -> Dict:
app.connect("html-page-context", fix_edit_html_page_context)
app.connect("html-page-context", update_search_sidebar_context)
app.connect("html-page-context", update_template_context)
app.connect("doctree-resolved", on_doctree_resolved)

app.connect("build-finished", replace_html_tag)
if use_ansys_search:
Expand Down
Loading