mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-14 02:46:16 +01:00
feat(paginate): add param home_paginate for home post pages and fix relURL bug
This commit is contained in:
parent
789bd994ff
commit
473900da79
10 changed files with 24 additions and 16 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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,6 +70,7 @@ staticDir = ["static", "../assets/others"] # static directories
|
|||
|
||||
#### Home Page Info
|
||||
home_mode = "post" # [post, other] home mode
|
||||
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
|
||||
|
||||
|
|
|
@ -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/
|
||||
|
||||
<!--more-->
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -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,6 +70,7 @@ staticDir = ["../static", "../../assets/others"] # 静态文件目录
|
|||
|
||||
#### 主页配置
|
||||
home_mode = "post" # [post, other] 主页模式
|
||||
home_paginate = 6 # post 主页模式下,主页每页显示的文章数目,默认等于 paginate 值
|
||||
avatar = "images/avatar.png" # 主页显示的头像路径
|
||||
subtitle = "一个简洁、优雅且高效的 Hugo 主题" # 主页显示的网站副标题
|
||||
|
||||
|
|
BIN
images/Apple-Devices-Preview.png
Normal file
BIN
images/Apple-Devices-Preview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 225 KiB |
|
@ -3,8 +3,14 @@
|
|||
<div class="post-warp">
|
||||
{{- 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 -}}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<link rel="next" href="{{ .NextInSection.Permalink }}" />
|
||||
{{ end -}}
|
||||
<link rel="canonical" href="{{ .Permalink }}" />
|
||||
<link rel='shortcut icon' type='image/x-icon' href='/favicon.ico' />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
{{ end }}
|
||||
{{ if $avatar }}
|
||||
<div class="home-avatar">
|
||||
<a href="/posts/">
|
||||
<img src={{ $avatar }} alt="avatar">
|
||||
<a href="/posts">
|
||||
<img src={{ $avatar | relURL }} alt="avatar">
|
||||
</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in a new issue