Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
drammock committed Jul 3, 2023
1 parent d4f3364 commit 124b761
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/user_guide/announcements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ By default, the value of your ``html_theme_options["announcement"]`` will be ins
For example, the following configuration adds a simple announcement.

.. code-block:: python
:caption: conf.py
html_theme_options = {
...
Expand All @@ -33,8 +34,35 @@ If the value of ``html_theme_options["announcement"]`` begins with **``http``**
For example, the following configuration tells the theme to load the ``custom-template.html`` example from this documentation's GitHub repository:

.. code-block:: python
:caption: conf.py
html_theme_options = {
...
"announcement": "https://github.com/pydata/pydata-sphinx-theme/raw/main/docs/_templates/custom-template.html",
}
Version warning banners
-----------------------

In addition to the general-purpose announcement banner, the theme includes a built-in banner to warn users when they are viewing versions of your docs other than the latest stable version. To use this feature, add the following to your ``conf.py``:

.. code-block:: python
:caption: conf.py
html_theme_options = {
...
"show_version_warning_banner": True,
}
.. warning::

This functionality relies on the :ref:`version switcher <version-dropdowns>` to determine the version number of the latest stable release.
*It will only work* if your version switcher ``.json`` has exactly one entry with property ``"preferred": true``
and a ``name`` property that begins with a version string that is parsable by the `compare-versions node module <https://www.npmjs.com/package/compare-versions>`__, for example:

.. code-block:: json
{
"name": "9.9.9 (current)",
"version": "stable",
"url": "https://anything"
}
2 changes: 2 additions & 0 deletions docs/user_guide/version-dropdown.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _version-dropdowns:

Version switcher dropdowns
==========================

Expand Down

0 comments on commit 124b761

Please sign in to comment.