diff --git a/README.md b/README.md index f95264e8..87c4c0b3 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt/) a Since the three themes have a similar look, if you have questions about their differences, read [Why choose LoveIt](#why-choose-loveit) so that you can choose the one that works best for you. -![Hugo Theme LoveIt](exampleSite/static/images/Apple-Devices-Preview.png) +![Hugo Theme LoveIt](images/Apple-Devices-Preview.png) ## [Demo Site](https://hugo-loveit-en.netlify.com) diff --git a/README.zh.md b/README.zh.md index 085ecd32..740a7df4 100644 --- a/README.zh.md +++ b/README.zh.md @@ -10,7 +10,7 @@ 由于三个主题外观的相似性,如果你对于它们的不同之处有疑问,请阅读 [为什么选择 LoveIt](#为什么选择-LoveIt),以便你能选择最适合你的一个。 -![Hugo 主题 LoveIt](exampleSite/static/images/Apple-Devices-Preview.png) +![Hugo 主题 LoveIt](images/Apple-Devices-Preview.png) ## 主题[预览](https://hugo-loveit-zh.netlify.com) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 7b6e0213..8c9f68ef 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -5,7 +5,7 @@ title = "LoveIt Theme" # website title theme = "LoveIt" # theme enableGitInfo = false # whether to use git commit log to generate lastmod record hasCJKLanguage = false # whether to include chinese/japanese/korean -paginate = 8 # amount of posts in each page only when home_mode is post +paginate = 12 # default amount of posts in each pages enableEmoji = true # whether to use emoji code enableRobotsTXT = true # whether to use robots.txt googleAnalytics = "" # [UA-XXXXXXXX-X] google analytics code @@ -70,7 +70,8 @@ staticDir = ["static", "../assets/others"] # static directories #### Home Page Info home_mode = "post" # [post, other] home mode - avatar = "images/avatar.png" # URL of avatar shown in home page + home_paginate = 6 # special amount of posts in each home post page + avatar = "images/avatar.png" # URL of avatar shown in home page subtitle = "A Clean, Elegant but Advanced Hugo Theme" # subtitle shown in home page socialShare = true # whether to show social share links in post page diff --git a/exampleSite/content/posts/test.md b/exampleSite/content/posts/test.md index 46f6876d..3e169d32 100644 --- a/exampleSite/content/posts/test.md +++ b/exampleSite/content/posts/test.md @@ -4,7 +4,7 @@ date: 2019-08-04T22:49:56+08:00 lastmod: 2019-08-17T22:41:56+08:00 draft: true description: "This is a test page." -show_in_homepage: false +show_in_homepage: true show_description: false tags: [] @@ -24,7 +24,7 @@ dev: true Test all features in development[^link test]. -[^link test]: http://www.google.com/ +[^link test]: https://www.google.com/ @@ -286,7 +286,7 @@ int a = 1; ## Test Img -![Gif](http://pvuonn2xy.bkt.clouddn.com/uploads/2019-08-08%2013:59:32-2019-08-08%2013.56.05.gif "Title") +![Gif](https://static.dillonzq.com/images/20190817130904-U6cPUk.jpg "Title") ## Test Align diff --git a/exampleSite/zh/config.toml b/exampleSite/zh/config.toml index 024d4f2b..d5da8efc 100644 --- a/exampleSite/zh/config.toml +++ b/exampleSite/zh/config.toml @@ -5,7 +5,7 @@ title = "LoveIt 主题" # 网站标题 theme = "LoveIt" # 主题 enableGitInfo = false # 是否使用 git 信息来生成文章的上次修改时间 hasCJKLanguage = true # 是否包括中日韩文字 -paginate = 8 # post 模式下,主页每页显示的文章数目 +paginate = 12 # 默认每页列表显示的文章数目 enableEmoji = true # 是否使用 emoji 代码 enableRobotsTXT = true # 是否使用 robots.txt googleAnalytics = "" # [UA-XXXXXXXX-X] 谷歌分析代号 @@ -70,8 +70,9 @@ staticDir = ["../static", "../../assets/others"] # 静态文件目录 #### 主页配置 home_mode = "post" # [post, other] 主页模式 - avatar = "images/avatar.png" # 主页显示的头像路径 - subtitle = "一个简洁、优雅且高效的 Hugo 主题" # 主页显示的网站副标题 + home_paginate = 6 # post 主页模式下,主页每页显示的文章数目,默认等于 paginate 值 + avatar = "images/avatar.png" # 主页显示的头像路径 + subtitle = "一个简洁、优雅且高效的 Hugo 主题" # 主页显示的网站副标题 socialShare = true # 在文章页面是否使用分享功能 diff --git a/images/Apple-Devices-Preview.png b/images/Apple-Devices-Preview.png new file mode 100644 index 00000000..d1bd34c9 Binary files /dev/null and b/images/Apple-Devices-Preview.png differ diff --git a/layouts/index.html b/layouts/index.html index 60f46183..740169e2 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -3,8 +3,14 @@
{{- partial "home/profile.html" . -}} - {{ $paginator := .Paginate (where .Site.RegularPages "Type" "posts") -}} - {{ range where $paginator.Pages "Params.show_in_homepage" "!=" false -}} + {{ $paginator := where .Site.RegularPages "Type" "posts" -}} + {{ $paginator = where $paginator "Params.show_in_homepage" "!=" false -}} + {{ with .Site.Params.home_paginate -}} + {{ $paginator = $.Paginate $paginator . -}} + {{ else -}} + {{ $paginator = $.Paginate $paginator -}} + {{ end -}} + {{ range $paginator.Pages -}} {{ .Render "summary" -}} {{ end -}} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 35a652ee..586fa9a0 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -23,7 +23,7 @@ {{ end -}} - + diff --git a/layouts/partials/home/profile.html b/layouts/partials/home/profile.html index 04c0374c..5e51a72f 100644 --- a/layouts/partials/home/profile.html +++ b/layouts/partials/home/profile.html @@ -7,8 +7,8 @@ {{ end }} {{ if $avatar }}
- - avatar + + avatar
{{ end }} diff --git a/layouts/partials/paginator.html b/layouts/partials/paginator.html index 6b8a6057..3e9da84a 100644 --- a/layouts/partials/paginator.html +++ b/layouts/partials/paginator.html @@ -9,7 +9,7 @@ {{ range $pag.Pagers }} {{ $right := sub .TotalPages .PageNumber }} {{ $showNumber := or (le .PageNumber 1) (eq $right 0) }} - {{ $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 3)) (lt .PageNumber (add $pag.PageNumber 3))) }} + {{ $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 3)) (lt .PageNumber (add $pag.PageNumber 3))) }} {{ if $showNumber }} {{ $.Scratch.Set "__paginator.ellipsed" false }} {{ $.Scratch.Set "__paginator.shouldEllipse" false }}