I’ve been able to range through my posts by date on my index.html page. However, when I copy this code into another page (recent.md), it now doesn’t work. I made sure to put a .html shortcode so it would allow my markdown file to display html, but this didn’t help.
recent.md:
---
title: "Post 1"
publishDate: "1 Jan 2006"
---
{{< html >}}
<ul>
{{ range .Pages.ByPublishDate }}
<li>
<h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
<time>{{ .Date.Format "2 Jan 2006" }}</time>
</li>
{{ end }}
</ul>
{{< /html >}}
What appears on website: (bad)
What the same code appears as on my index.html: (good)
You have a section for posts. Each item in the section should be a post. Why do you want to include a summary of the posts as an item within the posts section? That doesn’t make sense.
I was wanting to have on my index.html a section for the top 3 most recent posts. Alongside that, I wanted a link to direct to a page where it displays all the most recent posts, so every post sorted by date, not just the top 3 most recent posts.