2024.7.23 修复分页bug

This commit is contained in:
小赵同学 committed 2024-07-23 19:56:26 +08:00
1 parent 704393f80a
commit 2bf1a16008
5 files changed
+31 -37

No files matched your search

+2
View File
@@ -2,3 +2,5 @@ baseURL = "https://52ql.cn"
languageCode = 'zh-cn' languageCode = 'zh-cn'
title = '小赵同学的博客' title = '小赵同学的博客'
theme = 'Ying' theme = 'Ying'
# 分页展示文章数 每页展示文章的数量
paginate = 5
-1
View File
@@ -18,7 +18,6 @@ description = "风吹云散,云卷云舒"
# 分页展示文章数 每页展示文章的数量 # 分页展示文章数 每页展示文章的数量
paginate = 5 paginate = 5
# 社交链接列表 # 社交链接列表
social = [ social = [
# GitHub 链接和图标 # GitHub 链接和图标
+6 -7
View File
@@ -4,26 +4,25 @@
<div class="recent-posts section"> <div class="recent-posts section">
<h2 class="section-header">随笔<i class="ri-quill-pen-line"></i></h2> <h2 class="section-header">随笔<i class="ri-quill-pen-line"></i></h2>
<div class="posts"> <div class="posts">
{{ range .Paginator.Pages }} {{ $paginator := .Paginate (where .Site.RegularPages "Type" "post") }}
{{ if eq .Type "post" }} {{ range $paginator.Pages }}
<div class="post"> <div class="post">
<div class="time">{{ .Date.Format "January 2, 2006" }}</div> <div class="time">{{ .Date.Format "January 2, 2006" }}</div>
<a href="{{ .Permalink }}">{{ .Title }}</a> <a href="{{ .Permalink }}">{{ .Title }}</a>
</div> </div>
{{ end }} {{ end }}
{{ end }}
</div> </div>
</div> </div>
</article> </article>
<ul class="pagination"> <ul class="pagination">
<li class="page-item page-previous"> <li class="page-item page-previous">
{{ if .Paginator.HasPrev }} {{ if $paginator.HasPrev }}
<a class="prev" title="上一页" href="{{ .Paginator.Prev.URL }}">上一页</a> <a class="prev" title="上一页" href="{{ $paginator.Prev.URL }}">上一页</a>
{{ end }} {{ end }}
</li> </li>
<li class="page-item page-next"> <li class="page-item page-next">
{{ if .Paginator.HasNext }} {{ if $paginator.HasNext }}
<a class="next" title="下一页" href="{{ .Paginator.Next.URL }}">下一页</a> <a class="next" title="下一页" href="{{ $paginator.Next.URL }}">下一页</a>
{{ end }} {{ end }}
</li> </li>
</ul> </ul>
+11 -17
View File
@@ -1,31 +1,25 @@
{{ define "main" }} {{ define "main" }}
<div id="pjax-container"> <article>
<article> <div class="post-list section">
<div class="recent-posts section"> {{ $paginator := .Paginate (where .Site.RegularPages "Type" "post") }}
<h2 class="section-header">随笔<i class="ri-quill-pen-line"></i></h2> {{ range $paginator.Pages }}
<div class="posts">
{{ range .Paginator.Pages }}
{{ if eq .Type "post" }}
<div class="post"> <div class="post">
<div class="time">{{ .Date.Format "January 2, 2006" }}</div> <div class="time">{{ .Date.Format "January 2, 2006" }}</div>
<a href="{{ .Permalink }}">{{ .Title }}</a> <a href="{{ .Permalink }}">{{ .Title }}</a>
</div> </div>
{{ end }} {{ end }}
{{ end }}
</div> </div>
</div> </article>
</article> <ul class="pagination">
<ul class="pagination">
<li class="page-item page-previous"> <li class="page-item page-previous">
{{ if .Paginator.HasPrev }} {{ if $paginator.HasPrev }}
<a class="prev" title="上一页" href="{{ .Paginator.Prev.URL }}">上一页</a> <a class="prev" title="上一页" href="{{ $paginator.Prev.URL }}">上一页</a>
{{ end }} {{ end }}
</li> </li>
<li class="page-item page-next"> <li class="page-item page-next">
{{ if .Paginator.HasNext }} {{ if $paginator.HasNext }}
<a class="next" title="下一页" href="{{ .Paginator.Next.URL }}">下一页</a> <a class="next" title="下一页" href="{{ $paginator.Next.URL }}">下一页</a>
{{ end }} {{ end }}
</li> </li>
</ul> </ul>
</div>
{{ end }} {{ end }}
+12 -12
View File
@@ -24,22 +24,22 @@ features = ['some', 'awesome', 'features']
# 如果主题有多个作者,使用数组来列出每个作者的信息 # 如果主题有多个作者,使用数组来列出每个作者的信息
authors = [ 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] [author]
# 作者的名字 # 作者的名字
name = 'Your name' name = 'Your name'
# 作者的个人网站或主页 # 作者的个人网站或主页
homepage = 'Your website' homepage = 'Your website'
# 如果是移植自其他现有主题,提供原始主题的信息 # 如果是移植自其他现有主题,提供原始主题的信息
[original] [original]
# 原始主题的作者名字 # 原始主题的作者名字
author = 'Name of original author' author = 'Name of original author'
# 原始主题作者的个人网站或主页 # 原始主题作者的个人网站或主页
homepage = 'Website of original author' homepage = 'Website of original author'
# 原始主题的 GitHub 仓库链接 # 原始主题的 GitHub 仓库链接
repo = 'https://github.com/owner/repo' repo = 'https://github.com/owner/repo'