I am following this link to figure out how to create an archives page. I am using the hugo-xmin theme with slight modifications.
As far as I understand, range
goes through the pages and should print them out. But, I am getting an additional 0001
also. I don't understand why. I'm still a beginner to Hugo and Go.
My output (circled portion in red not what I want)
My archives.html
{{ partial "header.html" . }}
<div class="article-meta">
<h1><span class="title">{{ .Title | markdownify }}</span></h1>
{{ with .Params.author }}<h2 class="author">{{ . }}</h2>{{ end }}
{{ if (gt .Params.date 0) }}<h2 class="date">{{ .Date.Format "2006/01/02" }}</h2>{{ end }}
</div>
<main class="content" role="main">
<div class="inner">
{{ range (.Site.RegularPages.GroupByDate "2006") }}
<h3>{{ .Key }}</h3>
<ul>
{{ range (where .Pages "Type" "post") }}
<li>
<span class="date">{{ .Date.Format "2006/01/02" }}</span>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</li>
{{ end }}
</ul>
{{ end }}
</div>
</main>
{{ partial "footer.html" . }}
My archives.md
---
title: "Archives"
layout: "archives"
draft: false
---
This is archives
My directory structure
.
├── archetypes
│ └── default.md
├── config.toml
├── content
│ ├── about.md
│ ├── archives.md
│ ├── _index.md
│ ├── post
│ │ ├── first_post.md
│ │ ├── sample_code.md
│ │ └── test_math.md
│ └── reading.md
├── data
├── layouts
├── static
└── themes
└── mytheme
├── archetypes
│ └── default.md
├── layouts
│ ├── 404.html
│ ├── archives.html
│ ├── _default
│ │ ├── archives.html
│ │ ├── list.html
│ │ ├── single.html
│ │ └── terms.html
│ ├── index.html
│ └── partials
│ ├── foot_custom.html
│ ├── footer.html
│ ├── head_custom.html
│ └── header.html
├── LICENSE.md
├── static
│ ├── css
│ │ ├── fonts.css
│ │ └── style.css
│ └── js
└── theme.toml
15 directories, 25 files