{{ define "main" -}}
<div class="posts">
{{ range .Site.RegularPages -}}
<article class="post">
<h1 class="post-title">
<a href="{{ .Permalink }}">{{ .Title }}</a>
</h1>
<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z0700" }}" class="post-date">{{ .Date.Format "Mon, Jan 2, 2006" }}</time>
{{ .Summary }}
{{ if .Truncated }}
<div class="read-more-link">
<a href="{{ .RelPermalink }}">Read More…</a>
</div>
{{ end }}
</article>
{{- end }}
</div>
{{- end }}
I tried changing part of the code index.html with only one of folders, called “posts”, with this code:
{{ range where .Site.Recent "/posts/" }}
{{ .Render "li" }}
{{ end }}
I have tried my shitty google-fu, read documentation but there’s nothing mentioning how to include one folder of posts in my home page. How do I fix it?
I also tried this as index.html in website/layouts/index.html and nothing happens. The behavior is different though: This code actually builds the website, but doesn’t apply the layout file.