I’ve got a template that looks like this:
<div class="site-content">
<div class="inner">
<main class="site-main">
<article class="post">
<header class="entry-header">
<div class="entry-header-wrap">
<h1 class="entry-title">{{ .Title }}</h1>
</div><!-- .entry-header-wrap -->
</header><!-- .entry-header -->
<div class="entry-content">
{{ range (where .Site.Pages "Type" "post").GroupByDate "2006" }}
<h2 class="archive-title">{{ .Key }}</h2>
{{ range .Pages }}
<article class="archive-item">
<a href="{{ .Permalink }}" class="archive-item-link">{{ .Title }}</a>
<span class="archive-item-date">
{{ .Date.Format "January 2, 2006" }}
</span>
</article>
{{ end }}
{{ end }}
</div><!-- .entry-content -->
</article><!-- .post -->
</main><!-- .site-main -->
{{ partial "sidebar.html" . }}
</div><!-- .inner -->
</div><!-- .site-content -->
I think the code is right, but it’s not doing what I want it to and I’m not really sure how to debug it. At the top of the list, there’s a “Posts” link that points back to the Post listing. You can see it happening here: https://cweagans.net/archive/
Am I doing something wrong here? Or is the range
directive doing something wonky? I’d like to narrow down if this is a Hugo bug or not.