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

是否可以在 frontmatter 中添加 description属性来展示摘要 #218

Closed
jinguoguang opened this issue Sep 26, 2024 · 3 comments · Fixed by #224
Closed

是否可以在 frontmatter 中添加 description属性来展示摘要 #218

jinguoguang opened this issue Sep 26, 2024 · 3 comments · Fixed by #224

Comments

@jinguoguang
Copy link

希望可以在 frontmatter 中添加 description 属性来展示摘要,而不只是以形式展示

@pengzhanbo
Copy link
Owner

而不只是以形式展示

我没理解这句话。

现在的 文章摘要 是直接通过 <!-- more --> 直接在文章中提取出一部分内容,同时过滤掉了其中可能包含的标题,仅保留正文内容。

我认为它可以满足 展示摘要的需求。 我不清楚 添加 description 的理由,或许你可以更详细的描述下你的想法。

@jinguoguang
Copy link
Author

我希望摘要只展示在博客列表中,而不在文章中展示。<!-- more -->会在文章中展示

@pengzhanbo
Copy link
Owner

我理解你的想法,我在 frontmatter 中添加了 excerpt 用于自定义文章摘要,且优先级高于 <!-- more -->
但它实际上不如 <!-- more --> 好用,即使你可以在 excerpt 字段中拼接 html 字符串。

早些年时我写文章时也觉得 摘要 应该单独写,不出现在 文章详情页里,或者不应该放在头部。而从我这几年的心得体会来说,如果你的文章在正文头部能够很好的对想写的内容进行提炼和概述,这对于后续内容的编写、对于读者的阅读体验,都是很好的帮助,而这份概述也可以很好的作为 文章的摘要出现在 列表中。

这也是为什么我只做了 <!-- more --> 的支持的原因之一。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants