diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html
index acad6fe70..bd0cb541f 100644
--- a/layouts/partials/toc.html
+++ b/layouts/partials/toc.html
@@ -1,5 +1,5 @@
{{ $hasHeaders := gt (len (findRE "(.|\n)*?" .Content)) 0 }}
-{{ if (and $.Site.Data.config.enableToc (ne .Params.enableToc false) $hasHeaders) }}
+{{ if (or (and (not $.Site.Data.config.enableToc) .Params.enableToc) (and $.Site.Data.config.enableToc (ne .Params.enableToc false) $hasHeaders)) }}