{{ define "main" }}

  <article>
    <header>
      <h1>{{ .Title }}</h1>
      {{ if .Params.subtitle }}<p>{{ .Params.subtitle }}</p>{{ end }}
      {{ partial "article-info.html" . }}
    </header>

    {{ if .Params.toc }}
      <details>
        <summary>Table of Contents</summary>
        {{ .TableOfContents }}
      </details>
    {{ end }}

    {{ .Content }}

    <footer>
      <nav>
        <ul class="pagination article-navigation">
          {{ if .PrevInSection }}
            <li class="pagination__item pagination__prev article-navigation__item article-navigation__prev">
              <a title="Previous {{ .Type }}" href="{{ .PrevInSection.Permalink }}">&larr; {{ .PrevInSection.Title }}</a>
            </li>
          {{ end }}

          {{ if .NextInSection }}
            <li class="pagination__item pagination__next article-navigation__item article-navigation__next">
              <a title="Next {{ .Type }}" href="{{ .NextInSection.Permalink }}">{{ .NextInSection.Title }} &rarr;</a>
            </li>
          {{ end }}
        </ul>
      </nav>
    </footer>
  </article>

{{ end }}

{{ define "main" }}

  <article>
    <header>
      <h1>{{ .Title }}</h1>
      {{ if .Params.subtitle }}<p>{{ .Params.subtitle }}</p>{{ end }}
      {{ partial "article-info.html" . }}

      {{ if .IsPage }}
        {{ if .Params.toc }}
          <details>
            <summary>Table of Contents</summary>
            {{ .TableOfContents }}
          </details>
        {{ end }}
      {{ end }}
    </header>

    {{ .Content }}

    <footer>
      <nav>
        <ul class="pagination article-navigation">
          {{ if .PrevInSection }}
            <li class="pagination__item pagination__prev article-navigation__item article-navigation__prev">
              <a title="Previous {{ .Type }}" href="{{ .PrevInSection.Permalink }}">&larr; {{ .PrevInSection.Title }}</a>
            </li>
          {{ end }}

          {{ if .NextInSection }}
            <li class="pagination__item pagination__next article-navigation__item article-navigation__next">
              <a title="Next {{ .Type }}" href="{{ .NextInSection.Permalink }}">{{ .NextInSection.Title }} &rarr;</a>
            </li>
          {{ end }}
        </ul>
      </nav>
    </footer>
  </article>

{{ end }}

Move table of contents to header.
Move table of contents to header.

The dropcap styling wasn't being applied if the header was present.

Also, the table of contents semantically belongs in the header.

Finally, only show the table of contents on pages, not on aggregate views.
