🎨 Finish archives page coding.

This commit is contained in:
凡梦星尘
2022-06-07 18:16:40 +08:00
parent 517ddcdf84
commit 168fb20cbb
24 changed files with 184 additions and 26 deletions

View File

@@ -17,7 +17,7 @@
<link rel="icon" type="image/png" sizes="32x32" href="{{ .Site.Params.favicon.medium }}">
<link rel="apple-touch-icon" sizes="180x180" href="{{ .Site.Params.favicon.appleTouchIcon }}">
{{- partial "head.html" . }}
<title>{{ .Title | default .Site.Title }}</title>
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
<noscript>
<link rel="stylesheet" href="/css/noscript.css">
</noscript>
@@ -37,7 +37,7 @@
</header>
<!-- Widgets -->
{{ partial "widgets.html" . }}
<div class="main-inner {{ block "main_class" . }}{{ end }} posts-expand">
<div class="main-inner {{ block "main_inner_class" . }}{{ end }}">
<!-- Submenu,Content,Comment -->
{{- block "main" . }}{{- end }}
{{- if .IsPage }}

View File

@@ -0,0 +1,37 @@
{{- define "title" }}
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "AllSome" }} - {{ .Site.Title -}}
{{- end -}}
{{ define "main_inner_class" }}archive posts-collapse{{ end }}
{{- define "main" }}
<div class="post-block">
<div class="post-content">
<div class="collection-title">
{{- $cheers := "Um" }}
{{- $posts := .Scratch.Get "posts" }}
{{- if gt $posts 210 }}
{{- $cheers = "Excellent" }}
{{- else if gt $posts 130 }}
{{- $cheers = "Great" }}
{{- else if gt $posts 80 }}
{{- $cheers = "Good" }}
{{- else if gt $posts 50 }}
{{- $cheers = "Nice" }}
{{- else if gt $posts 30 }}
{{- $cheers = "Ok" }}
{{- end }}
<span class="collection-header">
{{- T (printf "PostArchiveCheers%s" $cheers) }}
{{- T "SymbolComma"}}
{{- T "ArchiveCounterTitle" $posts }}
{{- T "SymbolComma"}}
{{- T "PostArchiveKeepOn" }}
</span>
</div>
{{ range (.Paginate (.Data.Pages.GroupByDate "2006") 5 ).PageGroups }}
{{- partial "post/list.html" . }}
{{ end }}
</div>
</div>
{{- partial "pagination.html" . }}
{{- end }}

View File

@@ -1,4 +1,5 @@
{{- define "main_class" }}page{{- end }}
{{- define "title" }}{{- .Title }} - {{ .Site.Title -}}{{- end }}
{{- define "main_inner_class" }}post posts-expand{{- end }}
{{- define "main" }}
{{ partial "post_content.html" (dict "ctx" . "IsHome" false) }}
{{ partial "post/index.html" (dict "ctx" . "IsHome" false) }}
{{- end }}