diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index fc18764..1a38074 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -44,12 +44,12 @@ menus: weight: 1 - identifier: about name: 关于 - url: /ablout.html + url: /about.html pre: user weight: 2 - identifier: archives name: 归档 - url: /archives + url: /posts pre: archive weight: 3 - identifier: commonweal @@ -59,7 +59,9 @@ menus: weight: 4 params: - mainSections: ["post"] + mainSections: ["posts"] + yearFormat: "2006" + monthFormat: "01-02" dateFormat: "2006-01-02" timeFormat: "2006-01-02T15:04:05-07:00" # --------------------------------------------------------------- @@ -753,7 +755,7 @@ params: # AddThis Share. See: https://www.addthis.com # Go to https://www.addthis.com/dashboard to customize your tools. - addThisId: + addThisId: # --------------------------------------------------------------- diff --git a/exampleSite/content/post/hello-world.md b/exampleSite/content/posts/hello-world.md similarity index 100% rename from exampleSite/content/post/hello-world.md rename to exampleSite/content/posts/hello-world.md diff --git a/exampleSite/content/post/markdown-syntax.md b/exampleSite/content/posts/markdown-syntax.md similarity index 100% rename from exampleSite/content/post/markdown-syntax.md rename to exampleSite/content/posts/markdown-syntax.md diff --git a/i18n/en-us.yaml b/i18n/en-us.yaml index f2de6c7..2c969d6 100644 --- a/i18n/en-us.yaml +++ b/i18n/en-us.yaml @@ -1,6 +1,18 @@ #-------------------------------------- # English Version #-------------------------------------- +posts: + other: Posts +tag: + other: Tag +tags: + other: Tags +category: + other: Category +categories: + other: Categories +AllSome: + other: "All {{ .Some }}" NavToggleLabel: other: Toggle navigation bar @@ -10,6 +22,10 @@ MSearchLabel: SymbolColon: other: ":" +SymbolComma: + other: "," +SymbolPeriod: + other: "." SitePostsTitle: other: "Posts" @@ -28,6 +44,36 @@ CCLinkTitle: BackTopLabel: 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: other: "Publish" PostPublishTime: diff --git a/i18n/zh-cn.yaml b/i18n/zh-cn.yaml index 15f6ad9..b99368f 100644 --- a/i18n/zh-cn.yaml +++ b/i18n/zh-cn.yaml @@ -2,6 +2,19 @@ # 中文版本 #-------------------------------------- +posts: + other: 文章 +tag: + other: 标签 +tags: + other: 标签 +category: + other: 分类 +categories: + other: 分类 +AllSome: + other: "所有 {{ .Some }}" + NavToggleLabel: other: 切换导航栏 @@ -10,7 +23,11 @@ MSearchLabel: SymbolColon: other: ":" - +SymbolComma: + other: "," +SymbolPeriod: + other: "。" + SbPostsLable: other: 日志 SbCatesTitle: @@ -28,6 +45,34 @@ CCLinkTitle: BackTopLabel: 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: other: 置顶 PostPublishDate: diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index c28859c..0a5ec90 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -17,7 +17,7 @@ {{- partial "head.html" . }} - {{ .Title | default .Site.Title }} + {{ block "title" . }}{{ .Site.Title }}{{ end }} @@ -37,7 +37,7 @@ {{ partial "widgets.html" . }} -
+
{{- block "main" . }}{{- end }} {{- if .IsPage }} diff --git a/layouts/_default/section.html b/layouts/_default/section.html new file mode 100644 index 0000000..8efef6f --- /dev/null +++ b/layouts/_default/section.html @@ -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" }} +
+
+
+ {{- $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 }} + + {{- T (printf "PostArchiveCheers%s" $cheers) }} + {{- T "SymbolComma"}} + {{- T "ArchiveCounterTitle" $posts }} + {{- T "SymbolComma"}} + {{- T "PostArchiveKeepOn" }} + +
+ {{ range (.Paginate (.Data.Pages.GroupByDate "2006") 5 ).PageGroups }} + {{- partial "post/list.html" . }} + {{ end }} + +
+
+{{- partial "pagination.html" . }} +{{- end }} \ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html index d02bf58..6d20ea0 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -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 }} \ No newline at end of file diff --git a/layouts/index.html b/layouts/index.html index aa32668..11234b8 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,8 +1,8 @@ -{{- define "main_class" }}index{{- end }} +{{- define "main_inner_class" }}index posts-expand{{- end }} {{- define "main" }} {{ $paginator := .Paginate (where .Site.RegularPages "Section" "in" .Site.Params.mainSections) }} {{- range $paginator.Pages }} -{{ partial "post_content.html" (dict "ctx" . "IsHome" true) }} +{{ partial "post/index.html" (dict "ctx" . "IsHome" true) }} {{- end }} {{- partial "partials/pagination.html" . }} {{- end }} \ No newline at end of file diff --git a/layouts/partials/post/post_body.html b/layouts/partials/post/body.html similarity index 100% rename from layouts/partials/post/post_body.html rename to layouts/partials/post/body.html diff --git a/layouts/partials/post/post_footer.html b/layouts/partials/post/footer.html similarity index 81% rename from layouts/partials/post/post_footer.html rename to layouts/partials/post/footer.html index ccfd07c..2c258b6 100644 --- a/layouts/partials/post/post_footer.html +++ b/layouts/partials/post/footer.html @@ -9,12 +9,12 @@ {{- end }}
{{- else }} -{{ partial "post/post_footer/tags.html" . }} +{{ partial "post/footer_meta/tags.html" . }} {{ partial "_thirdparty/share/addthis.html" . }}
-{{ partial "post/post_footer/reward.html" . }} -{{ partial "post/post_footer/copyright.html" . }} -{{ partial "post/post_footer/followme.html" . }} +{{ partial "post/footer_meta/reward.html" . }} +{{ partial "post/footer_meta/copyright.html" . }} +{{ partial "post/footer_meta/followme.html" . }}
{{- with .NextInSection }} diff --git a/layouts/partials/post/post_footer/copyright.html b/layouts/partials/post/footer_meta/copyright.html similarity index 100% rename from layouts/partials/post/post_footer/copyright.html rename to layouts/partials/post/footer_meta/copyright.html diff --git a/layouts/partials/post/post_footer/followme.html b/layouts/partials/post/footer_meta/followme.html similarity index 100% rename from layouts/partials/post/post_footer/followme.html rename to layouts/partials/post/footer_meta/followme.html diff --git a/layouts/partials/post/post_footer/reward.html b/layouts/partials/post/footer_meta/reward.html similarity index 100% rename from layouts/partials/post/post_footer/reward.html rename to layouts/partials/post/footer_meta/reward.html diff --git a/layouts/partials/post/post_footer/tags.html b/layouts/partials/post/footer_meta/tags.html similarity index 100% rename from layouts/partials/post/post_footer/tags.html rename to layouts/partials/post/footer_meta/tags.html diff --git a/layouts/partials/post/post_header.html b/layouts/partials/post/header.html similarity index 80% rename from layouts/partials/post/post_header.html rename to layouts/partials/post/header.html index 7eb1ed2..0ef33a4 100644 --- a/layouts/partials/post/post_header.html +++ b/layouts/partials/post/header.html @@ -13,7 +13,7 @@
-

+ {{- if $.IsHome }}

{{- if and .Weight (gt .Weight 0) }} @@ -35,18 +35,18 @@ {{- end }} {{- end }} -

+ {{- if $.IsHome }} {{ else }} {{ end -}} diff --git a/layouts/partials/post/post_meta/categories.html b/layouts/partials/post/header_meta/categories.html similarity index 100% rename from layouts/partials/post/post_meta/categories.html rename to layouts/partials/post/header_meta/categories.html diff --git a/layouts/partials/post/post_meta/created_date.html b/layouts/partials/post/header_meta/created_date.html similarity index 100% rename from layouts/partials/post/post_meta/created_date.html rename to layouts/partials/post/header_meta/created_date.html diff --git a/layouts/partials/post/post_meta/readtime.html b/layouts/partials/post/header_meta/readtime.html similarity index 100% rename from layouts/partials/post/post_meta/readtime.html rename to layouts/partials/post/header_meta/readtime.html diff --git a/layouts/partials/post/post_meta/update_date.html b/layouts/partials/post/header_meta/update_date.html similarity index 100% rename from layouts/partials/post/post_meta/update_date.html rename to layouts/partials/post/header_meta/update_date.html diff --git a/layouts/partials/post/post_meta/views.html b/layouts/partials/post/header_meta/views.html similarity index 100% rename from layouts/partials/post/post_meta/views.html rename to layouts/partials/post/header_meta/views.html diff --git a/layouts/partials/post/post_meta/words.html b/layouts/partials/post/header_meta/words.html similarity index 100% rename from layouts/partials/post/post_meta/words.html rename to layouts/partials/post/header_meta/words.html diff --git a/layouts/partials/post_content.html b/layouts/partials/post/index.html similarity index 51% rename from layouts/partials/post_content.html rename to layouts/partials/post/index.html index 5bcf8d3..b67e13e 100644 --- a/layouts/partials/post_content.html +++ b/layouts/partials/post/index.html @@ -2,11 +2,11 @@
- {{ partial "post/post_header.html" (dict "ctx" .ctx "IsHome" .IsHome) }} + {{ partial "post/header.html" (dict "ctx" .ctx "IsHome" .IsHome) }} - {{ partial "post/post_body.html" (dict "ctx" .ctx "IsHome" .IsHome) }} + {{ partial "post/body.html" (dict "ctx" .ctx "IsHome" .IsHome) }}
- {{ partial "post/post_footer.html" (dict "ctx" .ctx "IsHome" .IsHome) }} + {{ partial "post/footer.html" (dict "ctx" .ctx "IsHome" .IsHome) }}
diff --git a/layouts/partials/post/list.html b/layouts/partials/post/list.html new file mode 100644 index 0000000..97a9481 --- /dev/null +++ b/layouts/partials/post/list.html @@ -0,0 +1,27 @@ +
+ {{ .Key }} +
+{{ range .Pages }} + +{{ end }} \ No newline at end of file