Section content not showing

I have a section “kontakt” with an index.md inside for my contact page.
In layouts I have a folder “kontakt” with a template “section.html” inside.
I verified that this template is used (putting some garbage in the file).

my problem is, that the content and title of the index.md is not showing, only the partials around them.

the template is:

{{/*
layout for contact page
*/}}
{{ define "main" }}
<article>
ssss
  <div class="text entry-content">
    {{ .Content }}
  </div>
  {{ partial "tools/contact-form.html" . }}
</article>
{{ end }}

{{ .Content }} is not showing. What am I doing wrong?

I got it working with the following template, but somehow think that’s reinventing the wheel :wink:

{{ define "main" }}
  {{ with .Site.GetPage "page" "kontakt/index.md" }}
    <article>
      <header class="title">
        <h2 class="entry-title">
          <a href="{{ .Permalink }}">
            {{ .Title }}
          </a>
        </h2>
      </header>
      <div class="text entry-content">
        {{ .Content }}
      </div>
      {{ partial "tools/contact-form.html" . }}
    </article>
  {{ end }}
{{ end }}
  • Sections have content files on the form “_index.md”

Not sure that is the magic bullet here, but you asked the question.

1 Like

Yep. #ilearnedsomethingtoday