diff --git a/docs/customization.rst b/docs/customization.rst
index dba7f1741..e535d561d 100644
--- a/docs/customization.rst
+++ b/docs/customization.rst
@@ -50,6 +50,8 @@ Configuration Options
If true, TOC entries that are not ancestors of the current page are collapsed.
``globaltoc_includehidden``
If true, the global TOC tree will also contain hidden entries.
+``globaltoc_includeinternal``
+ If false, the global TOC tree will not contain internal section headings
``theme_color``
The theme color for mobile browsers. Hex Color without the leading #.
``color_primary``
diff --git a/sphinx_material/sphinx_material/globaltoc.html b/sphinx_material/sphinx_material/globaltoc.html
index 675cb9adb..35f564a86 100644
--- a/sphinx_material/sphinx_material/globaltoc.html
+++ b/sphinx_material/sphinx_material/globaltoc.html
@@ -1,8 +1,16 @@
{% set toctree = toctree(maxdepth=theme_globaltoc_depth|toint, collapse=theme_globaltoc_collapse|tobool, includehidden=theme_globaltoc_includehidden|tobool) %}
+{% set toc_nodes = derender_toc(toc, True, pagename) if display_toc else [] %}
{% if toctree and sidebars and 'globaltoc.html' in sidebars %}
{% set toctree_nodes = derender_toc(toctree, False) %}
{%- for item in toctree_nodes recursive %}
+{#
+ note: since toc_nodes only contains entries to the current page ("#xxx"), it
+ is not necessary to encode complex control logic in the below "if" statement
+ supporting theme_globaltoc_includeinternal to check that we are indeed in a
+ subtree of the current page
+#}
+ {% if (theme_globaltoc_includeinternal|tobool) or (item not in (toc_nodes[0].children if toc_nodes else [])) %}
-
{% if "caption" in item %}
{{ item.caption }}
@@ -22,6 +30,7 @@
{%- endif %}
{% endif %}
+ {% endif %}
{%- endfor %}
{# TODO: Fallback to toc? #}
diff --git a/sphinx_material/sphinx_material/theme.conf b/sphinx_material/sphinx_material/theme.conf
index 8d4fb59cf..0de3e3020 100644
--- a/sphinx_material/sphinx_material/theme.conf
+++ b/sphinx_material/sphinx_material/theme.conf
@@ -48,6 +48,8 @@ globaltoc_depth = 1
globaltoc_collapse = true
# If true, the global TOC tree will also contain hidden entries
globaltoc_includehidden = true
+# If false, the global TOC tree will not contain internal section headings
+globaltoc_includeinternal = true
# Colors
# The theme color for mobile browsers. Hex color.
@@ -109,4 +111,4 @@ version_json = "versions.json"
# Table classes to _not_ strip. Must be a list. Classes on this list are *not*
# removed from tables. All other classes are removed, and only tables with outclasses
# are styled by default.
-table_classes =
\ No newline at end of file
+table_classes =