-
Notifications
You must be signed in to change notification settings - Fork 613
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #225 from pad92/archives
[Feature] Archives
- Loading branch information
Showing
2 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{{ define "header" }} | ||
<header class="header-section "> | ||
<div class="intro-header no-img"> | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1"> | ||
<div class="page-heading"> | ||
<h1>archives</h1> | ||
<hr class="small"> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</header> | ||
{{ end }} | ||
{{ define "main" }} | ||
{{- $paginator := .Paginate .Pages.ByDate.Reverse}} | ||
<div class="container" role="main"> | ||
<div class="row"> | ||
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1"> | ||
<div class="posts-list"> | ||
<section id="archive" class="archive"> | ||
{{- range $index, $element := $paginator.Pages -}} | ||
{{- $thisYear := $element.Date.Format "2006" }} | ||
{{- $lastElement := $index | add -1 | index $paginator.Pages }} | ||
{{ if or (eq $index 0) ( ne ($lastElement.Date.Format "2006") $thisYear ) }} | ||
<div class="collection-title"> | ||
<h2 class="archive-year">{{ $thisYear }}</h2> | ||
</div> | ||
{{- end }} | ||
<div class="archive-post"> | ||
<span class="archive-post-time"> | ||
{{ $element.Date.Format "01-02" }} | ||
</span> | ||
<span class="archive-post-title"> | ||
<a href="{{ $element.RelPermalink }}" class="archive-post-link"> | ||
{{ .Title }} | ||
</a> | ||
</span> | ||
</div> | ||
{{- end -}} | ||
</section> | ||
</div> | ||
{{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }} | ||
<ul class="pager main-pager"> | ||
{{ if .Paginator.HasPrev }} | ||
<li class="previous"> | ||
<a href="{{ .RelPermalink }}page/{{ .Paginator.Prev.PageNumber }}/">← {{ i18n "newerPosts" }}</a> | ||
</li> | ||
{{ end }} | ||
{{ if .Paginator.HasNext }} | ||
<li class="next"> | ||
<a href="{{ .RelPermalink }}page/{{ .Paginator.Next.PageNumber }}/">{{ i18n "olderPosts" }} →</a> | ||
</li> | ||
{{ end }} | ||
</ul> | ||
{{ end }} | ||
</div> | ||
</div> | ||
</div> | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters