diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html index 42f7e61..f6055c6 100644 --- a/layouts/partials/toc.html +++ b/layouts/partials/toc.html @@ -1,13 +1,13 @@ +{{- $headers := findRE "(.|\n])+?" .Content -}} +{{- $has_headers := ge (len $headers) 1 -}} +{{- if $has_headers -}}
{{- i18n "toc" | default "Table of Contents" }}
-
- {{- $headers := findRE "(.|\n])+?" .Content -}} - {{- $has_headers := ge (len $headers) 1 -}} - {{- if $has_headers -}} +
{{- $largest := 6 -}} {{- range $headers -}} {{- $headerLevel := index (findRE "[1-6]" . 1) 0 -}} @@ -87,7 +87,7 @@ {{- end -}} {{- end }} - {{- end }}
+{{- end }}