Skip to content

Commit 5aabf7e

Browse files
authored
chore: prioritize page descriptions (#356)
1 parent 9d62b34 commit 5aabf7e

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

docs/pages/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010
### Changed
1111

1212
- Remove author display if both post author and site author are not set [#354](https://github.com/g1eny0ung/hugo-theme-dream/pull/354)
13+
- Prioritize page descriptions over page summaries [#356](https://github.com/g1eny0ung/hugo-theme-dream/pull/356)
1314

1415
## [3.10.0] - 2025-01-07
1516

layouts/_default/summary.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ <h2 class="card-title">{{ .Title }}</h2>
3838
{{ end }}
3939
</p>
4040

41-
{{ .Summary | emojify | safeHTML }}
41+
{{ or .Description (.Summary | emojify | safeHTML) }}
4242

4343
{{ $hasAuthor := or .Params.author site.Params.author }}
4444
<div class="card-actions justify-between items-center mt-4">

layouts/partials/head.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{{ if eq .Type "posts" }}
88
<!-- Page Author & Description -->
99
<meta name="author" content="{{ if isset .Params "author" }}{{ .Params.author }}{{ else }}{{ site.Params.author }}{{ end }}" />
10-
<meta name="description" content="{{ .Summary | plainify }}" />
10+
<meta name="description" content="{{ (or .Description .Summary) | plainify }}" />
1111

1212
<!-- Keywords -->
1313
{{- $keywords := slice }}

layouts/section/search.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ <h2 class="card-title" x-text="post.item.title"></h2>
6565

6666
{{ $data := slice }}
6767
{{ range (where site.RegularPages "Type" "posts") }}
68-
{{ $data = $data | append (dict "title" .Title "url" .RelPermalink "author" .Params.author "avatar" .Params.avatar "categories" .Params.categories "tags" .Params.tags "description" (.Summary | emojify | safeHTML) "readingTime" .ReadingTime) }}
68+
{{ $data = $data | append (dict "title" .Title "url" .RelPermalink "author" .Params.author "avatar" .Params.avatar "categories" .Params.categories "tags" .Params.tags "description" (or .Description (.Summary | emojify | safeHTML)) "readingTime" .ReadingTime) }}
6969
{{ end }}
7070

7171
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/fuse.min.js" integrity="sha256-42IbU8t3tOwwbexB7ZVRHm3YDRf65aBPPjRtIUufj5I=" crossorigin="anonymous"></script>

0 commit comments

Comments
 (0)