{{- define "main" -}} <h1>{{ .Title }}</h1> {{ .Content }} <hr> {{- /* Creating a section that lists out regular pages by year */ -}} {{ range $.Site.RegularPages.GroupByPublishDate "2006" }} {{- /* Skip regular pages with an invalid creation date string. */ -}} {{- /* This is convenient if we want to exclude certain posts to be listed by giving no value to `date` in the frontmatter." /><metaname="twitter:card"content="summary"/>
<metaname="twitter:title"content="Creating an archive page"/>
{{- define "main" -}} <h1>{{ .Title }}</h1> {{ .Content }} <hr> {{- /* Creating a section that lists out regular pages by year */ -}} {{ range $.Site.RegularPages.GroupByPublishDate "2006" }} {{- /* Skip regular pages with an invalid creation date string. */ -}} {{- /* This is convenient if we want to exclude certain posts to be listed by giving no value to `date` in the frontmatter."/>
<metaproperty="og:title"content="Creating an archive page"/>
{{- define "main" -}} <h1>{{ .Title }}</h1> {{ .Content }} <hr> {{- /* Creating a section that lists out regular pages by year */ -}} {{ range $.Site.RegularPages.GroupByPublishDate "2006" }} {{- /* Skip regular pages with an invalid creation date string. */ -}} {{- /* This is convenient if we want to exclude certain posts to be listed by giving no value to `date` in the frontmatter." />
{{- define "main" -}} <h1>{{ .Title }}</h1> {{ .Content }} <hr> {{- /* Creating a section that lists out regular pages by year */ -}} {{ range $.Site.RegularPages.GroupByPublishDate "2006" }} {{- /* Skip regular pages with an invalid creation date string. */ -}} {{- /* This is convenient if we want to exclude certain posts to be listed by giving no value to `date` in the frontmatter."><metaitemprop="datePublished"content="2020-10-20T20:36:55+08:00"/>
<p>This will add an archive page similar to archive pages <ahref="https://davidtranscend.com/archives/">like</a><ahref="https://lukesmith.xyz/blogindex.html">these</a>.</p>
<p>We will simply add this as a layout in our customized theme.
Let’s call it <code>archives</code> so we have to add a file in <code>layouts/_default/archives.html</code> then set a page of our project with the <code>layout</code> key in the frontmatter.</p>
</div>
<divclass="paragraph">
<p>We want the archives page to be accessed at <code>$.Site.BaseURL/archives</code> so we’ll simply create <code>archives.adoc</code> (<ahref="https://gohugo.io/content-management/formats/#list-of-content-formats">any valid content files with certain file extensions can do</a>, I’m using <ahref="https://asciidoctor.org/">Asciidoctor</a>) with the following example content.</p>