diff --git a/config.toml b/config.toml
index 71ad6c569..1d3cc70e9 100644
--- a/config.toml
+++ b/config.toml
@@ -204,6 +204,10 @@ katex = false
# Can be set at page or section levels, following the hierarchy: page > section > config. See: https://github.com/welpo/tabi/pull/128
quick_navigation_buttons = false
+# Add a Table of Contents to posts, right below the title and metadata.
+# Can be set at page or section levels, following the hierarchy: page > section > config. See: https://github.com/welpo/tabi/pull/128
+toc = false
+
# Date format used when listing posts (main page, /blog section, tag posts list…)
# Default is "6th July 2049" in English and "%d %B %Y" in other languages.
long_date_format = "%d %B %Y"
diff --git a/templates/macros/content.html b/templates/macros/content.html
index 8ee39594d..b37df89a1 100644
--- a/templates/macros/content.html
+++ b/templates/macros/content.html
@@ -19,7 +19,8 @@
"katex",
"quick_navigation_buttons",
"show_reading_time",
- "show_remote_changes"
+ "show_remote_changes",
+ "toc",
] %}
@@ -95,7 +96,7 @@ TL;DR:
{% endif %}
{# Optional table of contents below the header #}
- {% if page.extra.toc | default(value=false) and page.toc %}
+ {% if page.toc and macros_settings::evaluate_setting_priority(setting="toc", page=page, default_global_value=false) == "true" %}
{{ macros_toc::toc(page=page, header=true) }}
{% endif %}
diff --git a/theme.toml b/theme.toml
index 35635ed5d..a92357dad 100644
--- a/theme.toml
+++ b/theme.toml
@@ -89,6 +89,10 @@ katex = false
# Can be set at page or section levels, following the hierarchy: page > section > config. See: https://github.com/welpo/tabi/pull/128
quick_navigation_buttons = false
+# Add a Table of Contents to all posts, right below the title and metadata.
+# Can be set at page or section levels, following the hierarchy: page > section > config. See: https://github.com/welpo/tabi/pull/128
+# toc = false
+
# Date format used when listing posts (main page, /blog section, tag posts list…)
# Default is "6th July 2049" in English and "%d %B %Y" in other languages.
# long_date_format = "%d %B %Y"