Skip to content

Commit

Permalink
chore: prioritize page descriptions (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
g1eny0ung authored Jan 20, 2025
1 parent 9d62b34 commit 5aabf7e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/pages/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed

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

## [3.10.0] - 2025-01-07

Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h2 class="card-title">{{ .Title }}</h2>
{{ end }}
</p>

{{ .Summary | emojify | safeHTML }}
{{ or .Description (.Summary | emojify | safeHTML) }}

{{ $hasAuthor := or .Params.author site.Params.author }}
<div class="card-actions justify-between items-center mt-4">
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{ if eq .Type "posts" }}
<!-- Page Author & Description -->
<meta name="author" content="{{ if isset .Params "author" }}{{ .Params.author }}{{ else }}{{ site.Params.author }}{{ end }}" />
<meta name="description" content="{{ .Summary | plainify }}" />
<meta name="description" content="{{ (or .Description .Summary) | plainify }}" />

<!-- Keywords -->
{{- $keywords := slice }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/section/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ <h2 class="card-title" x-text="post.item.title"></h2>

{{ $data := slice }}
{{ range (where site.RegularPages "Type" "posts") }}
{{ $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) }}
{{ $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) }}
{{ end }}

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

0 comments on commit 5aabf7e

Please sign in to comment.