Related Posts by Section

There may be a simpler approach.

If you just want to list the other pages in the current section, place this in a single.html template:

{{ range where (where site.RegularPages "Section" .Section) "Permalink" "ne" .Permalink }}
  <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
{{ end }}

If you have defined related content in your site configuration, and you only wish to display related pages within the current section, place this in a single.html template:

{{ range where (site.RegularPages.Related .) "Section" .Section }}
  <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
{{ end }}
6 Likes