🎨 Finish archives page coding.
This commit is contained in:
parent
517ddcdf84
commit
168fb20cbb
@ -44,12 +44,12 @@ menus:
|
|||||||
weight: 1
|
weight: 1
|
||||||
- identifier: about
|
- identifier: about
|
||||||
name: 关于
|
name: 关于
|
||||||
url: /ablout.html
|
url: /about.html
|
||||||
pre: user
|
pre: user
|
||||||
weight: 2
|
weight: 2
|
||||||
- identifier: archives
|
- identifier: archives
|
||||||
name: 归档
|
name: 归档
|
||||||
url: /archives
|
url: /posts
|
||||||
pre: archive
|
pre: archive
|
||||||
weight: 3
|
weight: 3
|
||||||
- identifier: commonweal
|
- identifier: commonweal
|
||||||
@ -59,7 +59,9 @@ menus:
|
|||||||
weight: 4
|
weight: 4
|
||||||
|
|
||||||
params:
|
params:
|
||||||
mainSections: ["post"]
|
mainSections: ["posts"]
|
||||||
|
yearFormat: "2006"
|
||||||
|
monthFormat: "01-02"
|
||||||
dateFormat: "2006-01-02"
|
dateFormat: "2006-01-02"
|
||||||
timeFormat: "2006-01-02T15:04:05-07:00"
|
timeFormat: "2006-01-02T15:04:05-07:00"
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
@ -1,6 +1,18 @@
|
|||||||
#--------------------------------------
|
#--------------------------------------
|
||||||
# English Version
|
# English Version
|
||||||
#--------------------------------------
|
#--------------------------------------
|
||||||
|
posts:
|
||||||
|
other: Posts
|
||||||
|
tag:
|
||||||
|
other: Tag
|
||||||
|
tags:
|
||||||
|
other: Tags
|
||||||
|
category:
|
||||||
|
other: Category
|
||||||
|
categories:
|
||||||
|
other: Categories
|
||||||
|
AllSome:
|
||||||
|
other: "All {{ .Some }}"
|
||||||
|
|
||||||
NavToggleLabel:
|
NavToggleLabel:
|
||||||
other: Toggle navigation bar
|
other: Toggle navigation bar
|
||||||
@ -10,6 +22,10 @@ MSearchLabel:
|
|||||||
|
|
||||||
SymbolColon:
|
SymbolColon:
|
||||||
other: ":"
|
other: ":"
|
||||||
|
SymbolComma:
|
||||||
|
other: ","
|
||||||
|
SymbolPeriod:
|
||||||
|
other: "."
|
||||||
|
|
||||||
SitePostsTitle:
|
SitePostsTitle:
|
||||||
other: "Posts"
|
other: "Posts"
|
||||||
@ -28,6 +44,36 @@ CCLinkTitle:
|
|||||||
BackTopLabel:
|
BackTopLabel:
|
||||||
other: "Top"
|
other: "Top"
|
||||||
|
|
||||||
|
TagsCounterTitle:
|
||||||
|
zero: No tags
|
||||||
|
one: 1 tag in total
|
||||||
|
other: "{{ .Count }} tags in total"
|
||||||
|
CatesCounterTitle:
|
||||||
|
zero: No categories
|
||||||
|
one: 1 category in total
|
||||||
|
other: "{{ .Count }} categories in total"
|
||||||
|
ArchiveCounterTitle:
|
||||||
|
zero: No posts.
|
||||||
|
one: 1 post.
|
||||||
|
other: "{{ .Count }} posts in total."
|
||||||
|
|
||||||
|
PostArchiveCheersUm:
|
||||||
|
other: Um..
|
||||||
|
PostArchiveCheersOk:
|
||||||
|
other: Ok
|
||||||
|
PostArchiveCheersNice:
|
||||||
|
other: Nice
|
||||||
|
PostArchiveCheersGood:
|
||||||
|
other: Good
|
||||||
|
PostArchiveCheersGreat:
|
||||||
|
other: Great
|
||||||
|
PostArchiveCheersExcellent:
|
||||||
|
other: Excellent
|
||||||
|
PostArchiveKeepOn:
|
||||||
|
other: Keep on posting.╰(*°▽°*)╯
|
||||||
|
|
||||||
|
PostStickyTitle:
|
||||||
|
other: Strickys
|
||||||
PostPublishDate:
|
PostPublishDate:
|
||||||
other: "Publish"
|
other: "Publish"
|
||||||
PostPublishTime:
|
PostPublishTime:
|
||||||
|
@ -2,6 +2,19 @@
|
|||||||
# 中文版本
|
# 中文版本
|
||||||
#--------------------------------------
|
#--------------------------------------
|
||||||
|
|
||||||
|
posts:
|
||||||
|
other: 文章
|
||||||
|
tag:
|
||||||
|
other: 标签
|
||||||
|
tags:
|
||||||
|
other: 标签
|
||||||
|
category:
|
||||||
|
other: 分类
|
||||||
|
categories:
|
||||||
|
other: 分类
|
||||||
|
AllSome:
|
||||||
|
other: "所有 {{ .Some }}"
|
||||||
|
|
||||||
NavToggleLabel:
|
NavToggleLabel:
|
||||||
other: 切换导航栏
|
other: 切换导航栏
|
||||||
|
|
||||||
@ -10,6 +23,10 @@ MSearchLabel:
|
|||||||
|
|
||||||
SymbolColon:
|
SymbolColon:
|
||||||
other: ":"
|
other: ":"
|
||||||
|
SymbolComma:
|
||||||
|
other: ","
|
||||||
|
SymbolPeriod:
|
||||||
|
other: "。"
|
||||||
|
|
||||||
SbPostsLable:
|
SbPostsLable:
|
||||||
other: 日志
|
other: 日志
|
||||||
@ -28,6 +45,34 @@ CCLinkTitle:
|
|||||||
BackTopLabel:
|
BackTopLabel:
|
||||||
other: 返回顶部
|
other: 返回顶部
|
||||||
|
|
||||||
|
TagsCounterTitle:
|
||||||
|
zero: 暂无标签
|
||||||
|
one: 目前共计 1 个标签
|
||||||
|
other: "目前共计 %d 个标签"
|
||||||
|
CatesCounterTitle:
|
||||||
|
zero: 暂无分类
|
||||||
|
one: 目前共计 1 个分类
|
||||||
|
other: "目前共计 %d 个分类"
|
||||||
|
ArchiveCounterTitle:
|
||||||
|
zero: 暂无日志。
|
||||||
|
one: 目前共计 1 篇日志
|
||||||
|
other: "目前共计 {{ .Count }} 篇日志"
|
||||||
|
|
||||||
|
PostArchiveCheersUm:
|
||||||
|
other: 嗯..
|
||||||
|
PostArchiveCheersOk:
|
||||||
|
other: 还行
|
||||||
|
PostArchiveCheersNice:
|
||||||
|
other: 不错
|
||||||
|
PostArchiveCheersGood:
|
||||||
|
other: 很好
|
||||||
|
PostArchiveCheersGreat:
|
||||||
|
other: 非常好
|
||||||
|
PostArchiveCheersExcellent:
|
||||||
|
other: 太棒了
|
||||||
|
PostArchiveKeepOn:
|
||||||
|
other: 继续努力哟。╰(*°▽°*)╯
|
||||||
|
|
||||||
PostStickyTitle:
|
PostStickyTitle:
|
||||||
other: 置顶
|
other: 置顶
|
||||||
PostPublishDate:
|
PostPublishDate:
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<link rel="icon" type="image/png" sizes="32x32" href="{{ .Site.Params.favicon.medium }}">
|
<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 }}">
|
<link rel="apple-touch-icon" sizes="180x180" href="{{ .Site.Params.favicon.appleTouchIcon }}">
|
||||||
{{- partial "head.html" . }}
|
{{- partial "head.html" . }}
|
||||||
<title>{{ .Title | default .Site.Title }}</title>
|
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
|
||||||
<noscript>
|
<noscript>
|
||||||
<link rel="stylesheet" href="/css/noscript.css">
|
<link rel="stylesheet" href="/css/noscript.css">
|
||||||
</noscript>
|
</noscript>
|
||||||
@ -37,7 +37,7 @@
|
|||||||
</header>
|
</header>
|
||||||
<!-- Widgets -->
|
<!-- Widgets -->
|
||||||
{{ partial "widgets.html" . }}
|
{{ 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 -->
|
<!-- Submenu,Content,Comment -->
|
||||||
{{- block "main" . }}{{- end }}
|
{{- block "main" . }}{{- end }}
|
||||||
{{- if .IsPage }}
|
{{- if .IsPage }}
|
||||||
|
37
layouts/_default/section.html
Normal file
37
layouts/_default/section.html
Normal 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 }}
|
@ -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" }}
|
{{- define "main" }}
|
||||||
{{ partial "post_content.html" (dict "ctx" . "IsHome" false) }}
|
{{ partial "post/index.html" (dict "ctx" . "IsHome" false) }}
|
||||||
{{- end }}
|
{{- end }}
|
@ -1,8 +1,8 @@
|
|||||||
{{- define "main_class" }}index{{- end }}
|
{{- define "main_inner_class" }}index posts-expand{{- end }}
|
||||||
{{- define "main" }}
|
{{- define "main" }}
|
||||||
{{ $paginator := .Paginate (where .Site.RegularPages "Section" "in" .Site.Params.mainSections) }}
|
{{ $paginator := .Paginate (where .Site.RegularPages "Section" "in" .Site.Params.mainSections) }}
|
||||||
{{- range $paginator.Pages }}
|
{{- range $paginator.Pages }}
|
||||||
{{ partial "post_content.html" (dict "ctx" . "IsHome" true) }}
|
{{ partial "post/index.html" (dict "ctx" . "IsHome" true) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- partial "partials/pagination.html" . }}
|
{{- partial "partials/pagination.html" . }}
|
||||||
{{- end }}
|
{{- end }}
|
@ -9,12 +9,12 @@
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
<div class="post-eof"></div>
|
<div class="post-eof"></div>
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{ partial "post/post_footer/tags.html" . }}
|
{{ partial "post/footer_meta/tags.html" . }}
|
||||||
{{ partial "_thirdparty/share/addthis.html" . }}
|
{{ partial "_thirdparty/share/addthis.html" . }}
|
||||||
<hr/>
|
<hr/>
|
||||||
{{ partial "post/post_footer/reward.html" . }}
|
{{ partial "post/footer_meta/reward.html" . }}
|
||||||
{{ partial "post/post_footer/copyright.html" . }}
|
{{ partial "post/footer_meta/copyright.html" . }}
|
||||||
{{ partial "post/post_footer/followme.html" . }}
|
{{ partial "post/footer_meta/followme.html" . }}
|
||||||
<div class="post-nav">
|
<div class="post-nav">
|
||||||
<div class="post-nav-next post-nav-item">
|
<div class="post-nav-next post-nav-item">
|
||||||
{{- with .NextInSection }}
|
{{- with .NextInSection }}
|
@ -13,7 +13,7 @@
|
|||||||
<meta itemprop="description" content="{{ .Description | default .Summary }}">
|
<meta itemprop="description" content="{{ .Description | default .Summary }}">
|
||||||
</span>
|
</span>
|
||||||
<header class="post-header">
|
<header class="post-header">
|
||||||
<h2 class="post-title" itemprop="name headline">
|
{{- if $.IsHome }} <h2 {{ else }} <h1 {{ end -}} class="post-title" itemprop="name headline">
|
||||||
{{- if and .Weight (gt .Weight 0) }}
|
{{- if and .Weight (gt .Weight 0) }}
|
||||||
<span class="post-sticky-flag" title="{{ T "PostStickyTitle" }}">
|
<span class="post-sticky-flag" title="{{ T "PostStickyTitle" }}">
|
||||||
<i class="fa fa-thumbtack"></i>
|
<i class="fa fa-thumbtack"></i>
|
||||||
@ -35,18 +35,18 @@
|
|||||||
<a href="{{ $editURL }}" rel="noopener external nofollow noreferrer" target="_blank" class="exturl post-edit-link" title="{{ T "PostEditTitle" }}"><i class="fa fa-pen-nib"></i></a>
|
<a href="{{ $editURL }}" rel="noopener external nofollow noreferrer" target="_blank" class="exturl post-edit-link" title="{{ T "PostEditTitle" }}"><i class="fa fa-pen-nib"></i></a>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</h2>
|
{{- if $.IsHome }} </h2> {{ else }} </h1> {{ end -}}
|
||||||
<div class="post-meta-container">
|
<div class="post-meta-container">
|
||||||
<div class="post-meta-items">
|
<div class="post-meta-items">
|
||||||
{{ partial "post/post_meta/created_date.html" . }}
|
{{ partial "post/header_meta/created_date.html" . }}
|
||||||
{{ partial "post/post_meta/update_date.html" . }}
|
{{ partial "post/header_meta/update_date.html" . }}
|
||||||
{{ partial "post/post_meta/categories.html" . }}
|
{{ partial "post/header_meta/categories.html" . }}
|
||||||
</div>
|
</div>
|
||||||
{{- if not $.IsHome }}
|
{{- if not $.IsHome }}
|
||||||
<div class="post-meta-items">
|
<div class="post-meta-items">
|
||||||
{{ partial "post/post_meta/words.html" . }}
|
{{ partial "post/header_meta/words.html" . }}
|
||||||
{{ partial "post/post_meta/readtime.html" . }}
|
{{ partial "post/header_meta/readtime.html" . }}
|
||||||
{{ partial "post/post_meta/views.html" . }}
|
{{ partial "post/header_meta/views.html" . }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
@ -2,11 +2,11 @@
|
|||||||
<div class="post-block">
|
<div class="post-block">
|
||||||
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="{{ .Scratch.Get "lang" }}">
|
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="{{ .Scratch.Get "lang" }}">
|
||||||
|
|
||||||
{{ partial "post/post_header.html" (dict "ctx" .ctx "IsHome" .IsHome) }}
|
{{ partial "post/header.html" (dict "ctx" .ctx "IsHome" .IsHome) }}
|
||||||
<!-- POST BODY -->
|
<!-- POST BODY -->
|
||||||
{{ partial "post/post_body.html" (dict "ctx" .ctx "IsHome" .IsHome) }}
|
{{ partial "post/body.html" (dict "ctx" .ctx "IsHome" .IsHome) }}
|
||||||
<footer class="post-footer">
|
<footer class="post-footer">
|
||||||
{{ partial "post/post_footer.html" (dict "ctx" .ctx "IsHome" .IsHome) }}
|
{{ partial "post/footer.html" (dict "ctx" .ctx "IsHome" .IsHome) }}
|
||||||
</footer>
|
</footer>
|
||||||
</article>
|
</article>
|
||||||
</div>
|
</div>
|
27
layouts/partials/post/list.html
Normal file
27
layouts/partials/post/list.html
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<div class="collection-year">
|
||||||
|
<span class="collection-header">{{ .Key }}</span>
|
||||||
|
</div>
|
||||||
|
{{ range .Pages }}
|
||||||
|
<article itemscope itemtype="http://schema.org/Article">
|
||||||
|
<header class="post-header">
|
||||||
|
<div class="post-meta-container">
|
||||||
|
{{ $month := .Date.Format .Site.Params.monthFormat }}
|
||||||
|
<time itemprop="dateCreated" datetime="{{ .Date.Format .Site.Params.timeFormat }}" content="{{ $month }}">
|
||||||
|
{{ $month }}
|
||||||
|
</time>
|
||||||
|
</div>
|
||||||
|
<div class="post-title">
|
||||||
|
{{- if isset .Params "extlink" }}
|
||||||
|
<a href="{{ .Params.extlink }}" rel="noopener external nofollow noreferrer" target="_blank" class="exturl post-title-link post-title-link-external" title="">
|
||||||
|
<span itemprop="name">{{- .Title -}}</span>
|
||||||
|
<i class="fa fa-external-link-alt"></i>
|
||||||
|
</a>
|
||||||
|
{{- else }}
|
||||||
|
<a class="post-title-link" href="{{ .Permalink }}" itemprop="url">
|
||||||
|
<span itemprop="name">{{ .Title }}</span>
|
||||||
|
</a>
|
||||||
|
{{- end }}
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
</article>
|
||||||
|
{{ end }}
|
Loading…
Reference in New Issue
Block a user