Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat post nav #586

Merged
merged 3 commits into from
Jul 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions exampleSite/config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ viewer = true # Image Viewer
# tocStyleType = "decimal" # The TOC's CSS list-style-type property.
imageTitleAsCaption = true
# panel = false # Disable the post panel.
# nav = false # Disable post navigations.

[archive]
# basePath = "/archiv" # The base path of archive pages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Page parameters are located in page's [Front Matter](https://gohugo.io/content-m
| `postDate` | Boolean | `true` | Whether to display the post date in the post meta section.
| `copyright` | Boolean | `true` | Whether to display copyright section.
| `carousel` | Boolean | `false` | Show on carousel.
| `nav` | Boolean | `true` | Turn on/off the navigations.
| **Creative Commons License**
| `creativeCommons` | Object | - |
| `creativeCommons.by` | Boolean | `true` | Credit must be given to you, the creator.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ weight = 970
| `postDate` | Boolean | `true` | 是否显示发表日期
| `copyright` | Boolean | `true` | 是否显示版权部分
| `carousel` | Boolean | `false` | 是否在 Carousel 显示
| `nav` | Boolean | `true` | 是否显示上一篇和下一篇
| **Creative Commons License**
| `creativeCommons` | Object | - |
| `creativeCommons.by` | Boolean | `true` | 署名
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ weight = 970
| `postDate` | Boolean | `true` | 是否顯示發表日期
| `copyright` | Boolean | `true` | 是否顯示版權部分
| `carousel` | Boolean | `false` | 是否在 Carousel 顯示
| `nav` | Boolean | `true` | 是否顯示上一篇和下一篇
| **Creative Commons License**
| `creativeCommons` | Object | - |
| `creativeCommons.by` | Boolean | `true` | 署名
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ The site parameters are located in `config/_default/params.toml` by default.
| `post.tocStyleType` | String | `none` | The TOC's CSS `list-style-type` property.
| `post.imageTitleAsCaption` | Boolean | `false` | Use image title as caption.
| `post.panel` | Boolean | `true` | Turn on/off the post panel.
| `post.nav` | Boolean | `true` | Turn on/off the navigations.
| `viewer` | Boolean | true | [Image Viewer]({{< ref "docs/image-viewer" >}})
| `pwa` | Object | - | [Progressive Web Apps]({{< ref "/docs/pwa" >}})
| **Sidebar**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ weight = 980
| `post.tocStyleType` | String | `none` | 目录的 `list-style-type` CSS 属性。
| `post.imageTitleAsCaption` | Boolean | `false` | 将图片标题作为 caption。
| `post.panel` | Boolean | `true` | 是否显示 post panel。
| `post.nav` | Boolean | `true` | 是否顯示上一篇和下一篇。
| `viewer` | Boolean | true | [图片查看器]({{< ref "docs/image-viewer" >}})
| `pwa` | Object | - | [渐进式 web 应用]({{< ref "/docs/pwa" >}})
| **Sidebar**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ weight = 980
| `post.tocStyleType` | String | `none` | 目錄的 `list-style-type` CSS 屬性。
| `post.imageTitleAsCaption` | Boolean | `false` | 将图片标题作为 caption。
| `post.panel` | Boolean | `true` | 是否顯示 post panel。
| `post.nav` | Boolean | `true` | 是否顯示上一篇和下一篇。
| `viewer` | Boolean | true | [圖片查看器]({{< ref "docs/image-viewer" >}})
| `pwa` | Object | - | [漸進式 web 應用]({{< ref "/docs/pwa" >}})
| **Sidebar**
Expand Down
4 changes: 1 addition & 3 deletions layouts/partials/docs/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ <h1 class="card-title post-title my-2">{{ partial "helpers/title" . }}</h1>
{{- partial "post/reward" . -}}
{{- partial "hooks/content-end" . -}}
</div>
<div class="card-footer">
{{- partial "post/nav" . -}}
</div>
{{- partial "post/nav" . -}}
</article>
{{- partial "post/copyright/index" . -}}
{{- partial "post/comments" . -}}
4 changes: 1 addition & 3 deletions layouts/partials/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ <h1 class="card-title post-title my-2">{{ partial "helpers/title" . }}</h1>
{{- partial "post/reward" . -}}
{{- partial "hooks/content-end" . -}}
</div>
<div class="card-footer">
{{- partial "post/nav" . -}}
</div>
{{- partial "post/nav" . -}}
</article>
{{- partial "post/copyright/index" . -}}
{{- partial "post/related-posts" . -}}
Expand Down
28 changes: 15 additions & 13 deletions layouts/partials/post/nav.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{{- if or .PrevInSection .NextInSection -}}
<div class="post-navs d-flex justify-content-evenly">
{{- with .PrevInSection -}}
<div class="post-nav post-prev">
<i class="fas fa-fw fa-chevron-circle-down post-prev-icon" data-fa-transform="rotate-90"></i>
<a href="{{ .Permalink }}">{{ partial "helpers/title" . }}</a>
{{- if and (default true .Site.Params.post.nav) (default true .Params.nav) (or .PrevInSection .NextInSection) -}}
<div class="card-footer">
<div class="post-navs d-flex justify-content-evenly">
{{- with .PrevInSection -}}
<div class="post-nav post-prev">
<i class="fas fa-fw fa-chevron-down post-prev-icon me-1" data-fa-transform="rotate-90"></i>
<a href="{{ .Permalink }}">{{ partial "helpers/title" . }}</a>
</div>
{{- end -}}
{{- with .NextInSection -}}
<div class="post-nav post-next">
<a href="{{ .Permalink }}">{{ partial "helpers/title" . }}</a>
<i class="fas fa-fw fa-chevron-down post-next-icon ms-1" data-fa-transform="rotate-270"></i>
</div>
{{- end -}}
</div>
{{- end -}}
{{- with .NextInSection -}}
<div class="post-nav post-next">
<a href="{{ .Permalink }}">{{ partial "helpers/title" . }}</a>
<i class="fas fa-fw fa-chevron-circle-down post-next-icon" data-fa-transform="rotate-270"></i>
</div>
{{- end -}}
</div>
{{- end -}}