diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 110c2450..57f9ad37 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -16,11 +16,13 @@
{{- end }}
+{{- if .Content }}
{{- if not (.Param "disableAnchoredHeadings") }}
{{- partial "anchored_headings.html" .Content -}}
{{- else }}{{ .Content }}{{ end }}
+{{- end }}
{{- $pages := union .RegularPages .Sections }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 8a85fc81..8d42cd75 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -25,11 +25,15 @@
{{- if (.Param "ShowToc") }}
{{- partial "toc.html" . }}
{{- end }}
+
+ {{- if .Content }}
{{- if not (.Param "disableAnchoredHeadings") }}
{{- partial "anchored_headings.html" .Content -}}
{{- else }}{{ .Content }}{{ end }}
+ {{- end }}
+