From eab247912f51da9b00dd7c302dc5c8b7e85ca4ad Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 28 Aug 2025 15:23:44 +0000 Subject: [PATCH] feat: Hide right sidebar in documentation This commit implements a way to hide the right sidebar in the built documentation. Following the `awesomesphinx-theme` documentation, this change adds custom `layout.html` and `page.html` templates to conditionally hide the on-page table of contents. The `:notoc: true` metadata flag can now be added to any `.rst` file to hide the right sidebar. This has been applied to `index.rst` as an example. Additionally, this commit fixes a broken image link in `how_to_use.rst` that was discovered during the documentation build process. --- docs/_templates/layout.html | 13 +++++++++++++ docs/_templates/page.html | 9 +++++++++ docs/how_to_use.rst | 2 +- docs/index.rst | 2 ++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 docs/_templates/layout.html create mode 100644 docs/_templates/page.html diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html new file mode 100644 index 0000000..a091304 --- /dev/null +++ b/docs/_templates/layout.html @@ -0,0 +1,13 @@ +{%- extends "!layout.html" %} + +{{ super() }} + +{%- block main %} +{%- if meta is defined and meta is not none and 'notoc' in meta %} +
+{%- else %} +
+{%- endif %} +{%- block body %}{%- endblock %} +
+{%- endblock main %} diff --git a/docs/_templates/page.html b/docs/_templates/page.html new file mode 100644 index 0000000..f852f51 --- /dev/null +++ b/docs/_templates/page.html @@ -0,0 +1,9 @@ +{%- extends "!page.html" -%} + +{{ super() }} + +{%- block on_page_toc %} +{%- if (meta is not defined or meta is none or "notoc" not in meta) and display_toc %} +{%- include "toc.html" %} +{%- endif %} +{% endblock %} diff --git a/docs/how_to_use.rst b/docs/how_to_use.rst index f9d5677..b9ec035 100644 --- a/docs/how_to_use.rst +++ b/docs/how_to_use.rst @@ -37,7 +37,7 @@ Creating a static plot ds = xr.tutorial.open_dataset("era5-2mt-2019-03-uk.grib") plot_da(da=ds['t2m'].isel(time=0)) -.. image:: /_static/plot_da.png +.. image:: ../_static/plot_da.png :alt: Sample output of plot_da function :align: center :width: 75% diff --git a/docs/index.rst b/docs/index.rst index c271e50..c7e0406 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,3 +1,5 @@ +:notoc: true + .. _index: Welcome to mapflow's documentation!