From 16d3f95da3fbf79841379574fd4b70707da2f955 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 17 Dec 2025 16:27:13 +0100 Subject: [PATCH 1/7] feat: add news sidebar --- .../_templates/latest_news_sidebar.html | 187 ++++++++++++++++++ doc/source/_templates/layout.html | 5 + doc/source/conf.py | 28 +++ 3 files changed, 220 insertions(+) create mode 100644 doc/source/_templates/latest_news_sidebar.html diff --git a/doc/source/_templates/latest_news_sidebar.html b/doc/source/_templates/latest_news_sidebar.html new file mode 100644 index 0000000000..be1d812d8a --- /dev/null +++ b/doc/source/_templates/latest_news_sidebar.html @@ -0,0 +1,187 @@ +{# + Latest News Sidebar + Displays a box with latest news items in the sidebar if configured. + Supports both internal links and external URLs. + Optimized to work without external CSS files. +#} +{% if theme_latest_news %} + {% set latest_news_config = theme_latest_news %} + {% set latest_news_title = latest_news_config.get('title', 'Latest News') %} + {% set latest_news_items = latest_news_config.get('items', []) %} + {% set latest_news_show_date = latest_news_config.get('show_date', true) %} + {% set latest_news_max_items = latest_news_config.get('max_items', 5) %} + + +{% endif %} \ No newline at end of file diff --git a/doc/source/_templates/layout.html b/doc/source/_templates/layout.html index afaf8cbb92..58c56c9dd2 100644 --- a/doc/source/_templates/layout.html +++ b/doc/source/_templates/layout.html @@ -3,4 +3,9 @@ {%- block extrahead %} {{ super() }} +{% endblock %} + +{%- block sidebar %} + {{ super() }} + {% include "latest_news_sidebar.html" %} {% endblock %} \ No newline at end of file diff --git a/doc/source/conf.py b/doc/source/conf.py index 48585f2a85..3316d1c2df 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -213,6 +213,34 @@ "github_version": "main", "doc_path": "doc/source", "pyansys_tags": ["Structures"], + "latest_news": { + "title": "Latest PyMechanical News", + "show_date": True, + "max_items": 4, + "items": [ + { + "title": "PyMechanical v0.11.0 Released", + "date": "2024-12-15", + "url": "https://github.com/ansys/pymechanical/releases/tag/v0.11.0", + "excerpt": "New features include enhanced embedding support and improved documentation." + }, + { + "title": "Documentation Update", + "date": "2024-12-10", + "url": "/changelog.html", + "excerpt": "Updated examples and API documentation for better usability." + }, + { + "title": "Community Discussion Forum", + "date": "2024-12-01", + "url": "https://github.com/ansys/pymechanical/discussions", + "excerpt": "Join our community discussions for support and feature requests." + } + ], + "more_url": "https://github.com/ansys/pymechanical/releases", + "more_text": "View all releases" + }, + "secondary_sidebar_items": ["page-toc", "sourcelink", "latest_news_sidebar"], } html_theme_options = { "logo": "pyansys", From e0388fd5b549bf10d0a60259c49fc3514a3244bb Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 17 Dec 2025 16:42:45 +0100 Subject: [PATCH 2/7] feat: sidebar --- doc/source/_templates/latest_news_sidebar.html | 4 ++-- doc/source/_templates/layout.html | 4 ++-- doc/source/conf.py | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/source/_templates/latest_news_sidebar.html b/doc/source/_templates/latest_news_sidebar.html index be1d812d8a..3baaed0c8e 100644 --- a/doc/source/_templates/latest_news_sidebar.html +++ b/doc/source/_templates/latest_news_sidebar.html @@ -4,8 +4,8 @@ Supports both internal links and external URLs. Optimized to work without external CSS files. #} -{% if theme_latest_news %} - {% set latest_news_config = theme_latest_news %} +{% if latest_news %} + {% set latest_news_config = latest_news %} {% set latest_news_title = latest_news_config.get('title', 'Latest News') %} {% set latest_news_items = latest_news_config.get('items', []) %} {% set latest_news_show_date = latest_news_config.get('show_date', true) %} diff --git a/doc/source/_templates/layout.html b/doc/source/_templates/layout.html index 58c56c9dd2..9508badd8f 100644 --- a/doc/source/_templates/layout.html +++ b/doc/source/_templates/layout.html @@ -5,7 +5,7 @@ {% endblock %} -{%- block sidebar %} + \ No newline at end of file diff --git a/doc/source/conf.py b/doc/source/conf.py index 3316d1c2df..50ecaee33f 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -213,6 +213,9 @@ "github_version": "main", "doc_path": "doc/source", "pyansys_tags": ["Structures"], + "secondary_sidebar_items": { + "index": ["latest_news_sidebar"], + }, "latest_news": { "title": "Latest PyMechanical News", "show_date": True, @@ -240,7 +243,6 @@ "more_url": "https://github.com/ansys/pymechanical/releases", "more_text": "View all releases" }, - "secondary_sidebar_items": ["page-toc", "sourcelink", "latest_news_sidebar"], } html_theme_options = { "logo": "pyansys", From 62621170f48749f89ca641d3a23d6fa41fdb4d22 Mon Sep 17 00:00:00 2001 From: Revathyvenugopal162 Date: Wed, 17 Dec 2025 16:46:33 +0100 Subject: [PATCH 3/7] feat: update the conf --- doc/source/_templates/layout.html | 5 ----- doc/source/conf.py | 7 ++++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/doc/source/_templates/layout.html b/doc/source/_templates/layout.html index 9508badd8f..1555c6872d 100644 --- a/doc/source/_templates/layout.html +++ b/doc/source/_templates/layout.html @@ -4,8 +4,3 @@ {{ super() }} {% endblock %} - - \ No newline at end of file diff --git a/doc/source/conf.py b/doc/source/conf.py index 50ecaee33f..cc0a8a270f 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -213,9 +213,7 @@ "github_version": "main", "doc_path": "doc/source", "pyansys_tags": ["Structures"], - "secondary_sidebar_items": { - "index": ["latest_news_sidebar"], - }, + "latest_news": { "title": "Latest PyMechanical News", "show_date": True, @@ -272,6 +270,9 @@ "changelog_file_name": "changelog.rst", "sidebar_pages": ["changelog", "index"], }, + "secondary_sidebar_items": { + "index": ["latest_news_sidebar"], + }, "ansys_sphinx_theme_autoapi": {"project": project, "templates": "_templates/autoapi"}, } From c9d0b67f3d93bbc802f39f1090a5fb93d9013f5d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 17 Dec 2025 15:47:17 +0000 Subject: [PATCH 4/7] chore: auto fixes from pre-commit hooks --- .../_templates/latest_news_sidebar.html | 20 +++++++++---------- doc/source/conf.py | 13 ++++++------ 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/doc/source/_templates/latest_news_sidebar.html b/doc/source/_templates/latest_news_sidebar.html index 3baaed0c8e..64f4621eb5 100644 --- a/doc/source/_templates/latest_news_sidebar.html +++ b/doc/source/_templates/latest_news_sidebar.html @@ -10,7 +10,7 @@ {% set latest_news_items = latest_news_config.get('items', []) %} {% set latest_news_show_date = latest_news_config.get('show_date', true) %} {% set latest_news_max_items = latest_news_config.get('max_items', 5) %} - +