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

[BUG] strange display summary in home page #1077

Closed
wu0407 opened this issue Oct 6, 2023 · 3 comments
Closed

[BUG] strange display summary in home page #1077

wu0407 opened this issue Oct 6, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@wu0407
Copy link
Contributor

wu0407 commented Oct 6, 2023

Describe the bug 描述你遇到的错误

If a manual summary with more tag and contains the title it displays as HTML, not plaintext.

Expected behavior 期待的行为

Show only text regardless of whether it contains more tag or not.

Screenshots 屏幕截图

image

Build Environment 构建环境

Hugo 0.117.0

Preview Environment 预览环境

chrome

Additional Information 补充信息

relate issue: gohugoio/hugo#8910

@wu0407 wu0407 added the bug Something isn't working label Oct 6, 2023
@wu0407
Copy link
Contributor Author

wu0407 commented Oct 6, 2023

gohugoio/hugo#8562

@wu0407
Copy link
Contributor Author

wu0407 commented Oct 6, 2023

change like this:

diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html
index 1f38c69d..469109f4 100644
--- a/layouts/_default/summary.html
+++ b/layouts/_default/summary.html
@@ -83,7 +83,7 @@
     {{- /* Summary content */ -}}
     <div class="content">
         {{- with .Summary -}}
-            {{- dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
+            {{- dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | plainify | htmlUnescape  | chomp -}}
         {{- else -}}
             {{- .Description | safeHTML -}}
         {{- end -}}

result:
image

@HEIGE-PCloud
Copy link
Owner

HEIGE-PCloud commented Oct 6, 2023

Many people actually want this behaviour to display rich text in summary. In your case it makes more sense to hand-craft the summary in the front matter. i.e.

---
summary: "this is the plain text summary"
---

and remove the more tag.

Reference: https://gohugo.io/content-management/summaries/#summary-selection-order

@HEIGE-PCloud HEIGE-PCloud closed this as not planned Won't fix, can't repro, duplicate, stale Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants