From 2bf1a160086b7973ab56130221f5da4ae58fde6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=B5=B5=E5=90=8C=E5=AD=A6?= <94612053+imzql@users.noreply.github.com> Date: Tue, 23 Jul 2024 19:56:26 +0800 Subject: [PATCH] =?UTF-8?q?2024.7.23=20=20=E4=BF=AE=E5=A4=8D=E5=88=86?= =?UTF-8?q?=E9=A1=B5bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hugo.toml | 2 ++ themes/Ying/hugo.toml | 1 - themes/Ying/layouts/_default/home.html | 13 ++++--- themes/Ying/layouts/_default/list.html | 50 ++++++++++++-------------- themes/Ying/theme.toml | 24 ++++++------- 5 files changed, 42 insertions(+), 48 deletions(-) diff --git a/hugo.toml b/hugo.toml index 12bb1f1e..002e81c7 100644 --- a/hugo.toml +++ b/hugo.toml @@ -2,3 +2,5 @@ baseURL = "https://52ql.cn" languageCode = 'zh-cn' title = '小赵同学的博客' theme = 'Ying' +# 分页展示文章数 每页展示文章的数量 +paginate = 5 \ No newline at end of file diff --git a/themes/Ying/hugo.toml b/themes/Ying/hugo.toml index e8dc8f25..6d5060a2 100644 --- a/themes/Ying/hugo.toml +++ b/themes/Ying/hugo.toml @@ -18,7 +18,6 @@ description = "风吹云散,云卷云舒" # 分页展示文章数 每页展示文章的数量 paginate = 5 - # 社交链接列表 social = [ # GitHub 链接和图标 diff --git a/themes/Ying/layouts/_default/home.html b/themes/Ying/layouts/_default/home.html index ae4a2371..0edbc07c 100644 --- a/themes/Ying/layouts/_default/home.html +++ b/themes/Ying/layouts/_default/home.html @@ -4,26 +4,25 @@

随笔

- {{ range .Paginator.Pages }} - {{ if eq .Type "post" }} + {{ $paginator := .Paginate (where .Site.RegularPages "Type" "post") }} + {{ range $paginator.Pages }}
{{ .Date.Format "January 2, 2006" }}
{{ .Title }}
{{ end }} - {{ end }}
diff --git a/themes/Ying/layouts/_default/list.html b/themes/Ying/layouts/_default/list.html index 6752d95d..570da05e 100644 --- a/themes/Ying/layouts/_default/list.html +++ b/themes/Ying/layouts/_default/list.html @@ -1,31 +1,25 @@ {{ define "main" }} -
-
-
-

随笔

-
- {{ range .Paginator.Pages }} - {{ if eq .Type "post" }} -
-
{{ .Date.Format "January 2, 2006" }}
- {{ .Title }} -
- {{ end }} - {{ end }} -
+
+
+ {{ $paginator := .Paginate (where .Site.RegularPages "Type" "post") }} + {{ range $paginator.Pages }} +
+
{{ .Date.Format "January 2, 2006" }}
+ {{ .Title }}
-
-
    -
  • - {{ if .Paginator.HasPrev }} - - {{ end }} -
  • -
  • - {{ if .Paginator.HasNext }} - - {{ end }} -
  • -
-
+ {{ end }} +
+ + {{ end }} diff --git a/themes/Ying/theme.toml b/themes/Ying/theme.toml index 6f04e405..86b7f862 100644 --- a/themes/Ying/theme.toml +++ b/themes/Ying/theme.toml @@ -24,22 +24,22 @@ features = ['some', 'awesome', 'features'] # 如果主题有多个作者,使用数组来列出每个作者的信息 authors = [ - {name = 'Name of author', homepage = 'Website of author'}, - {name = 'Name of author', homepage = 'Website of author'} + { name = 'Name of author', homepage = 'Website of author' }, + { name = 'Name of author', homepage = 'Website of author' }, ] # 如果主题只有一个作者,使用单个作者的信息块 [author] - # 作者的名字 - name = 'Your name' - # 作者的个人网站或主页 - homepage = 'Your website' +# 作者的名字 +name = 'Your name' +# 作者的个人网站或主页 +homepage = 'Your website' # 如果是移植自其他现有主题,提供原始主题的信息 [original] - # 原始主题的作者名字 - author = 'Name of original author' - # 原始主题作者的个人网站或主页 - homepage = 'Website of original author' - # 原始主题的 GitHub 仓库链接 - repo = 'https://github.com/owner/repo' +# 原始主题的作者名字 +author = 'Name of original author' +# 原始主题作者的个人网站或主页 +homepage = 'Website of original author' +# 原始主题的 GitHub 仓库链接 +repo = 'https://github.com/owner/repo'