Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zhaohuabing/hugo-theme-cleanwhite.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt.Wang <mattwang44@gmail.com>2021-08-19 20:26:49 +0300
committerzhaohuabing <zhaohuabing@gmail.com>2021-08-28 05:50:20 +0300
commit9f65b08458d08770a3f919b1ca3617be523b1bd5 (patch)
tree8067c982587994801ea06c0a57628cc15cfd7071 /layouts
parentf983cbba47ae2332a7b5e87667ea75634e5af5a6 (diff)
feat: implement posts archiving page
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/archive.html45
1 files changed, 45 insertions, 0 deletions
diff --git a/layouts/_default/archive.html b/layouts/_default/archive.html
new file mode 100644
index 0000000..4a1bbf0
--- /dev/null
+++ b/layouts/_default/archive.html
@@ -0,0 +1,45 @@
+{{ define "main" }}
+{{ $pages := (where (where .Site.Pages "Type" "post") "IsPage" true) }}
+
+<div class="container">
+ <div class="row">
+ <div class="
+ col-lg-8 col-lg-offset-1
+ col-md-8 col-md-offset-1
+ col-sm-12
+ col-xs-12
+ post-container
+ ">
+ <div class="archive-list">
+ {{ range ($pages.GroupByDate "2006") }}
+ {{ if gt .Key 1 }}
+ {{ $.Scratch.Set "count" 1 }}
+ {{ range .Pages }}
+ {{ if (eq ($.Scratch.Get "count") 1) }}
+ {{ $.Scratch.Set "count" 0 }}
+ <h1 class="title is-4 has-text-weight-normal">{{ .Date.Format "2006" }}</h1>
+ {{ end }}
+ {{ end }}
+
+ <ul>
+ {{ range .Pages }}
+ <li>
+ <span>{{ .Date.Format "01/02" }}</span> —
+ <a href="{{ .RelPermalink }}">
+ {{ .Title }}
+ </a>
+ </li>
+ {{ end }}
+ </ul>
+
+ {{ end }}
+ {{ end }}
+ </div>
+ </div>
+ {{ partial "sidebar.html" . }}
+ </div>
+</div>
+
+
+<hr />
+{{ end }} \ No newline at end of file