alex-shpak / hugo-book

Hugo documentation theme as simple as plain book
https://hugo-book-demo.netlify.app
MIT License
3.21k stars 1.16k forks source link

Curious to know how to control the part of each blog that will display in the homepage of posts #612

Open Huilin-Li opened 3 months ago

Huilin-Li commented 3 months ago

For example, in this place (highlight in red rectangle), I only want to show the first paragraph of each blog. image

alex-shpak commented 3 months ago

hello! There is no configuration for this text (it uses summary provided by Hugo). But you can adjust template if you want in /layouts/posts/list.html

https://github.com/alex-shpak/hugo-book/blob/master/layouts/posts/list.html#L9

Huilin-Li commented 2 months ago

hello! There is no configuration for this text (it uses summary provided by Hugo). But you can adjust template if you want in /layouts/posts/list.html

https://github.com/alex-shpak/hugo-book/blob/master/layouts/posts/list.html#L9

@alex-shpak Hi, Alex, thanks for your reply. Since I don't have too much knowledge about html language, may I ask what key words I need to google about modifying your layout repository? For example, you point out the line-9 in layouts/posts/list.html, and I checked it is {{- .Summary -}}. So, I go to google html .Summary. However, google gives me all things about how to use <summary></summary> in <details></details> as a markdown.

I think there must be a knowledge gap, so I don't understand the code in layouts folder. Would you mind sharing some information or experience about learning and practicing these things? Thanks in advance!

alex-shpak commented 2 months ago

In this case it depends you will probably have to either regex your content or find some other trick, value of .Summary in hugo is very primitive