diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 02965f91c..88a859c3b 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -22,14 +22,7 @@
{{ .LinkTitle | humanize }}
{{ end }}
- {{ if (and $.Site.Data.config.enableToc (ne .Params.enableToc false)) }}
-
- {{end}}
+ {{partial "toc.html" .}}
{{partial "textprocessing.html" . }}
{{partial "footer.html" .}}
diff --git a/layouts/index.html b/layouts/index.html
index 466a05a39..ee33d7cc8 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -13,14 +13,7 @@
{{partial "darkmode.html" .}}
- {{ if (and $.Site.Data.config.enableToc (ne .Params.enableToc false)) }}
-
- {{end}}
+ {{partial "toc.html" .}}
{{partial "textprocessing.html" . }}
{{partial "footer.html" .}}
diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html
new file mode 100644
index 000000000..acda23d6d
--- /dev/null
+++ b/layouts/partials/toc.html
@@ -0,0 +1,8 @@
+{{ if (and $.Site.Data.config.enableToc (ne .Params.enableToc false) (gt .WordCount 250)) }}
+
+{{end}}