I have a site page written in markdown that includes YAML list data as follows:
---
title: "Week 1"
type: book
components:
- style: Moore v California
file: moore.md
_template: case
---
And I have a partial layout for publishing that markdown file that also pulls content from other .md files in the site:
{{ $headless := .Site.GetPage "/courses/property/cases" }}
{{ range .Params.Components }}
{{ if eq ._template "case"}}
{{ $file := print .file }}
{{ $reusablePages := $headless.Resources.Match $file }}
{{ range $reusablePages }}<h2>{{ .Params.style }}</h2>{{ end }}
{{ range $reusablePages }}{{ .Content }}{{ end }}
{{ end }}
{{ end }}
This works to pull the markdown content, but neither the headings in moore.md
nor those created in the partial (using <h2>
) appear in the table of contents (using {{ .TableOfContents }}
).
Is there a way to include these headings in the TOC?
(Thank you – this is my first post for support).