Skip to content

Commit 2e5396d

Browse files
authored
style: show the description if set (#964)
BREAKING CHANGE: remove the post.excerpt parameter
1 parent 0b0212c commit 2e5396d

11 files changed

Lines changed: 15 additions & 20 deletions

File tree

exampleSite/content/docs/configuration/site-params/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ The site parameters are located in `config/_default/params.toml` by default.
120120
| `codeBlock.lineNos` | Boolean | `true` | `true`/`false` represents that show/hide the line numbers by default.
121121
| **Post**
122122
| `post` | Object | - |
123-
| `post.excerpt` | String | `Summary` | Options: `description`
123+
| ~~`post.excerpt`~~ | String | `Description` | Deleted since `v1.2.1`, the description will be used as the excerpt if not empty.
124124
| `post.excerptMaxLength` | Integer | `320` |
125125
| `post.copyright` | Boolean | `true` | Whether to display copyright section on each post.
126126
| `post.plainifyExcerpt` | Boolean | `true` | Format excerpt in HTML if `false`.

exampleSite/content/docs/configuration/site-params/index.zh-hans.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ authors = ["RazonYang"]
123123
| `codeBlock.lineNos` | Boolean | `true` | `true`/`false` 表示默认情况下显示/隐藏行号。
124124
| **Post**
125125
| `post` | Object | - |
126-
| `post.excerpt` | String | `Summary` | 可选项:`description`
126+
| ~~`post.excerpt`~~ | String | `Description` | `v1.2.1` 删除,若 Description 不为空则作为摘要。
127127
| `post.excerptMaxLength` | Integer | `320` |
128128
| `post.copyright` | Boolean | `true` | 是否在每个帖子上显示版权部分
129129
| `post.plainifyExcerpt` | Boolean | `true` | `false` 则格式化摘要为 HTML。

exampleSite/content/docs/configuration/site-params/index.zh-hant.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ authors = ["RazonYang"]
123123
| `codeBlock.lineNos` | Boolean | `true` | `true`/`false` 表示默認情況下顯示/隱藏行號。
124124
| **Post**
125125
| `post` | Object | - |
126-
| `post.excerpt` | String | `Summary` | 可選項:`description`
126+
| ~~`post.excerpt`~~ | String | `Description` | `v1.2.1` 刪除,若 Description 不為空則作為摘要。
127127
| `post.excerptMaxLength` | Integer | `320` |
128128
| `post.copyright` | Boolean | `true` | 是否在每個帖子上顯示版權部分
129129
| `post.plainifyExcerpt` | Boolean | `true` | `false` 則格式化摘要為 HTML。

exampleSite/content/docs/content/index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,13 @@ $ hugo new posts/new-post/index.zh-cn.md
107107
108108
## Summaries Selection Order
109109

110-
1. If `post.excerpt = "description"` and `description` is not empty, then it'll be used.
110+
1. If the `description` is not empty, then it'll be used.
111111
1. Manual splitting via <code>&lt;!--more--&gt;</code>.
112112
1. If `summary` on front matter isn't empty, then `summary` will be selected.
113113
1. The text of content will be cut off by `post.excerptMaxLength` and formatted in plain text or HTML when `post.plainifyExcerpt = true`.
114114

115115
```toml {title="config/_default/params.toml"}
116116
[post]
117-
# excerpt = "description"
118117
# excerptMaxLength = 120
119118
# copyright = false # Whether to display copyright section on each post.
120119
# plainifyExcerpt = false # Format excerpt in HTML if false.

exampleSite/content/docs/content/index.zh-hans.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,13 @@ $ hugo new posts/new-post/index.zh-cn.md
105105
106106
## 摘要选择顺序
107107

108-
1. If `post.excerpt = "description"` and `description` is not empty, then it'll be used.
108+
1. If the `description` is not empty, then it'll be used.
109109
1. Manual splitting via <code>&lt;!--more--&gt;</code>.
110110
1. If `summary` on front matter isn't empty, then `summary` will be selected.
111111
1. The text of content will be cut off by `post.excerptMaxLength` and formatted in plain text or HTML when `post.plainifyExcerpt = true`.
112112

113113
```toml {title="config/_default/params.toml"}
114114
[post]
115-
# excerpt = "description"
116115
# excerptMaxLength = 120
117116
# copyright = false # Whether to display copyright section on each post.
118117
# plainifyExcerpt = false # Format excerpt in HTML if false.

exampleSite/content/docs/content/index.zh-hant.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,13 @@ $ hugo new posts/new-post/index.zh-tw.md
105105
106106
## 摘要選擇順序
107107

108-
1. If `post.excerpt = "description"` and `description` is not empty, then it'll be used.
108+
1. If the `description` is not empty, then it'll be used.
109109
1. Manual splitting via <code>&lt;!--more--&gt;</code>.
110110
1. If `summary` on front matter isn't empty, then `summary` will be selected.
111111
1. The text of content will be cut off by `post.excerptMaxLength` and formatted in plain text or HTML when `post.plainifyExcerpt = true`.
112112

113113
```toml {title="config/_default/params.toml"}
114114
[post]
115-
# excerpt = "description"
116115
# excerptMaxLength = 120
117116
# copyright = false # Whether to display copyright section on each post.
118117
# plainifyExcerpt = false # Format excerpt in HTML if false.

exampleSite/content/docs/getting-started/introduction/index.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# type = "docs"
33
title = "Introduction"
44
date = 2022-06-13T16:32:09+08:00
5-
# description = "" # Used by description meta tag, summary will be used instead if not set or empty.
5+
description = "Hugo Bootstrap Theme(HBS) is a fast, responsive, multipurpose and feature-rich Hugo theme. It is used for blog and document sites typically."
66
featured = false
77
draft = false
88
comment = true
@@ -19,10 +19,6 @@ navWeight = 100
1919
authors = ["RazonYang"]
2020
+++
2121

22-
Hugo Bootstrap Theme(HBS) is a fast, responsive, multipurpose and feature-rich Hugo theme. It is used for blog and document sites typically.
23-
24-
<!--more-->
25-
2622
## Goals
2723

2824
- Performance

exampleSite/content/posts/markdown-syntax/index.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
author = "Hugo Authors"
33
title = "Markdown Syntax Guide"
44
date = "2020-11-09"
5-
description = "Sample article showcasing basic Markdown syntax and formatting for HTML elements."
5+
description = "This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme."
66
featured = true
77
carousel = true
88
categories = [
@@ -28,8 +28,6 @@ authors = ["Hugo"]
2828
icon = '<i class="fab fa-markdown fa-fw text-success"></i>'
2929
+++
3030

31-
This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme.
32-
<!--more-->
3331

3432
## Headings
3533

layouts/partials/docs/post.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ <h1 class="card-title post-title my-2">{{ partial "helpers/title" . }}</h1>
66
<div class="card-body">
77
{{- partial "post/meta" . -}}
88
{{- partial "post/featured-image" . -}}
9+
{{- with .Description }}
10+
<p class="lead mb-3 text-body-emphasis">{{ . }}</p>
11+
{{- end }}
912
{{- partial "hooks/content-begin" . -}}
1013
{{- partial "post/toc-wrapper" . -}}
1114
{{- partial "post/content" . -}}

layouts/partials/post.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ <h1 class="card-title post-title my-2">{{ partial "helpers/title" . }}</h1>
66
<div class="card-body">
77
{{- partial "post/meta" . -}}
88
{{- partial "post/featured-image" . -}}
9+
{{- with .Description }}
10+
<p class="lead mb-3 text-body-emphasis">{{ . }}</p>
11+
{{- end }}
912
{{- partial "hooks/content-begin" . -}}
1013
{{- if eq "content" .Site.Params.tocPosition -}}
1114
{{- partial "post/toc" . -}}

0 commit comments

Comments
 (0)