From e83dbabc3f3100c995bf1d712c06c6131b2eb708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=A1=E6=A2=A6=E6=98=9F=E5=B0=98?= Date: Tue, 26 Jul 2022 22:18:43 +0800 Subject: [PATCH] :wrench: Archives page demo shows. --- .gitignore | 15 +++++- exampleSite/config.yaml | 4 +- exampleSite/content/about.md | 19 ------- exampleSite/content/archives/_index.md | 3 ++ .../content/{posts => post}/emoji-support.md | 0 .../content/{posts => post}/external-link.md | 0 .../content/{posts => post}/hello-world.md | 0 .../{posts => post}/markdown-syntax.md | 0 .../{posts => post}/syntax-highlighting.md | 0 .../{posts => post}/table-of-content.md | 0 i18n/en-us.toml | 49 ------------------- i18n/en.yaml | 2 +- i18n/zh-cn.toml | 49 ------------------- i18n/zh-cn.yaml | 2 +- layouts/_default/list.html | 8 +-- 15 files changed, 25 insertions(+), 126 deletions(-) delete mode 100644 exampleSite/content/about.md create mode 100644 exampleSite/content/archives/_index.md rename exampleSite/content/{posts => post}/emoji-support.md (100%) rename exampleSite/content/{posts => post}/external-link.md (100%) rename exampleSite/content/{posts => post}/hello-world.md (100%) rename exampleSite/content/{posts => post}/markdown-syntax.md (100%) rename exampleSite/content/{posts => post}/syntax-highlighting.md (100%) rename exampleSite/content/{posts => post}/table-of-content.md (100%) delete mode 100644 i18n/en-us.toml delete mode 100644 i18n/zh-cn.toml diff --git a/.gitignore b/.gitignore index 1a75d43..6b89457 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,17 @@ # Ignore files in Hugo NexT theme -exampleSite/ +exampleSite/* + +# Exclude special files in content folder !exampleSite/content +exampleSite/content/* +!exampleSite/content/archives +!exampleSite/content/post + +# Exclude special files in static folder +!exampleSite/static + +# Exclude special files +!exampleSite/config.yaml !exampleSite/start.sh -!exampleSite/config.yaml \ No newline at end of file + diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 8095f1d..0536ba9 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -86,7 +86,7 @@ menus: weight: 2 - identifier: archives name: 归档 - pageref: /posts + pageref: /archives pre: archive weight: 3 - identifier: commonweal @@ -103,7 +103,7 @@ params: # 需要显示文章的部分,即content目录下的文件夹名称 # Sections for show in home & archive page # and it's forlder name which under content - mainSections: ["posts"] + mainSections: ["post"] # 年,月,日及时间的格式化样式 # Format style for year,month,date & time yearFormat: "2006" diff --git a/exampleSite/content/about.md b/exampleSite/content/about.md deleted file mode 100644 index ae17cc8..0000000 --- a/exampleSite/content/about.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: "关于 Hugo NexT 组织" -description: "" - -date: 2022-06-09T20:12:52+08:00 -lastmod: 2022-06-09T20:12:52+08:00 - -share: false -followme: false -nav: false -copyright: false -url: about.html ---- - -`Hugo NexT` 组织是由众多喜爱 `NexT` 主题及风格的世界各地友人共同组建而成,为的就是让这个主题继续在 `Hugo` 引擎中也能得到发扬光大,在此也欢迎你的加入! - -# 我们的愿景 - -延续 `NexT` 经典的黑白调搭配,保持简单的易用性及强大的功能。 \ No newline at end of file diff --git a/exampleSite/content/archives/_index.md b/exampleSite/content/archives/_index.md new file mode 100644 index 0000000..542863e --- /dev/null +++ b/exampleSite/content/archives/_index.md @@ -0,0 +1,3 @@ +--- +date: 2022-07-26T21:46:25+08:00 +--- \ No newline at end of file diff --git a/exampleSite/content/posts/emoji-support.md b/exampleSite/content/post/emoji-support.md similarity index 100% rename from exampleSite/content/posts/emoji-support.md rename to exampleSite/content/post/emoji-support.md diff --git a/exampleSite/content/posts/external-link.md b/exampleSite/content/post/external-link.md similarity index 100% rename from exampleSite/content/posts/external-link.md rename to exampleSite/content/post/external-link.md diff --git a/exampleSite/content/posts/hello-world.md b/exampleSite/content/post/hello-world.md similarity index 100% rename from exampleSite/content/posts/hello-world.md rename to exampleSite/content/post/hello-world.md diff --git a/exampleSite/content/posts/markdown-syntax.md b/exampleSite/content/post/markdown-syntax.md similarity index 100% rename from exampleSite/content/posts/markdown-syntax.md rename to exampleSite/content/post/markdown-syntax.md diff --git a/exampleSite/content/posts/syntax-highlighting.md b/exampleSite/content/post/syntax-highlighting.md similarity index 100% rename from exampleSite/content/posts/syntax-highlighting.md rename to exampleSite/content/post/syntax-highlighting.md diff --git a/exampleSite/content/posts/table-of-content.md b/exampleSite/content/post/table-of-content.md similarity index 100% rename from exampleSite/content/posts/table-of-content.md rename to exampleSite/content/post/table-of-content.md diff --git a/i18n/en-us.toml b/i18n/en-us.toml deleted file mode 100644 index a162721..0000000 --- a/i18n/en-us.toml +++ /dev/null @@ -1,49 +0,0 @@ -#-------------------------------------- -# English Version -#-------------------------------------- - -[ColoneFlag] - other = ":" - -[SitePostsTitle] - other = "Posts" -[SiteCatesTitle] - other = "Categories" -[SiteTagsTitle] - other = "Tags" -[TableOfContents] - other = "TOC" -[SiteInfo] - other = "Site Info" -[RSSTitle] - other = "RSS Subscribe" -[CCLinkTitle] - other = "Creative Commons" - -[PostPublishDate] - other = "Publish" -[PostPublishTime] - other = "Create Time" -[PostLastModDate] - other = "Update" -[PostLastModTime] - other = "Modify Time" -[PostWords] - other = "Words" -[PostWordCount] - other = "{{- .WordCount -}}" -[PostReading] - other = "Read" -[PostReadTime] - other = "{{- .ReadingTime -}}min" -[PostVisitor] - other = "Views" -[PostCatg] - other = "Categories" -[PostTag] - other = "Tags" -[PostReadMore] - other = "Read More" - -[FooterPowerby] - other = "Power by %s" \ No newline at end of file diff --git a/i18n/en.yaml b/i18n/en.yaml index a719c45..a7ca413 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -1,7 +1,7 @@ #-------------------------------------- # English Version #-------------------------------------- -posts: +archives: other: Posts tag: other: Tag diff --git a/i18n/zh-cn.toml b/i18n/zh-cn.toml deleted file mode 100644 index 63d0942..0000000 --- a/i18n/zh-cn.toml +++ /dev/null @@ -1,49 +0,0 @@ -#-------------------------------------- -# 中文版本 -#-------------------------------------- - -[ColoneFlag] - other = ":" - -[SitePostsTitle] - other = "日志" -[SiteCatesTitle] - other = "分类" -[SiteTagsTitle] - other = "标签" -[TableOfContents] - other = "文章目录" -[SiteInfo] - other = "站点概览" -[RSSTitle] - other = "RSS 订阅" -[CCLinkTitle] - other = "共享知识" - -[PostPublishDate] - other = "发表于" -[PostPublishTime] - other = "创建时间" -[PostLastModDate] - other = "更新于" -[PostLastModTime] - other = "修改时间" -[PostWords] - other = "字数" -[PostWordCount] - other = "{{- .WordCount -}}" -[PostReading] - other = "阅读" -[PostReadTime] - other = "{{- .ReadingTime -}}分钟" -[PostVisitor] - other = "浏览数" -[PostCatg] - other = "分类" -[PostTag] - other = "标签" -[PostReadMore] - other = "阅读全文" - -[FooterPowerby] - other = "由 %s 强力驱动" \ No newline at end of file diff --git a/i18n/zh-cn.yaml b/i18n/zh-cn.yaml index 049d65e..1aa9600 100644 --- a/i18n/zh-cn.yaml +++ b/i18n/zh-cn.yaml @@ -2,7 +2,7 @@ # 中文版本 #-------------------------------------- -posts: +archives: other: 文章 tag: other: 标签 diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 3a56b50..42c686a 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,5 +1,7 @@ {{- if and .Page.IsSection (eq .Section "archives") }} - {{ partial "list.html" ((.Paginator (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections)).Pages.GroupByDate "2006") }} -{{- else }} - {{ partial "list.html" (.Paginator.Pages.GroupByDate "2006") }} + {{- $paginator := (.Paginate (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections) ).Pages.GroupByDate "2006" }} + {{ partial "list.html" $paginator }} +{{ else }} + {{- $paginator := .Paginator.Pages.GroupByDate "2006" }} + {{ partial "list.html" $paginator }} {{- end }}