8 Comments
Guest *Katie Larson* @ 2018-06-14 01:02:44 originally posted:
This was driving me crazy. Thank you!
Guest *Stuart Hertzog* @ 2018-06-17 18:53:40 originally posted:
When I add the code to _default/list.html for hyde-hyde template as described, and add "description" to the YAML meta for the post, then rebuild the site, the "posts" listing page shows a blank screen. Is there any other template file to which I have to add this code?
访客 *林志扬* @ 2018-07-20 13:22:35 写道:
I suggest using (.|n)*? instead of .*? when searching for paragraph contents, since a single line break won't start a new paragraph.
Guest *Luka* @ 2018-08-12 21:51:24 originally posted:
How do you not get advertising from Disqus? When I try configuring it on my blog, I got other blogs' advertising...
Guest *Zhen Li* @ 2018-12-07 07:55:05 originally posted:
This is amazing! Thank you so much!
Guest *dan* @ 2019-07-26 06:23:35 originally posted:
Great post, thank you! This helped get me started, but I didn't like that it truncated all content not wrapped in paragraph tags (e.g. lists, images, codeblocks, etc.) to [...]. Not a very helpful summary. I updated the RegEx to allow any tag type and it's working much better now:
https://gist.github.com/dbechrd/8fda19b671d793a498ff9d5245e5d090
Guest *Trang* @ 2020-01-03 23:26:32 originally posted:
Yihui, thank you so much for the clear explanation! This helped me publish my very first post!
However, I'm trying to modify the metadata in my head.html file, here's one line for example:
<meta name="description" content="{{ if .Description }}{{ .Description }}{{ else }}{{ .Summary | plainify }}{{ end }}
"/>
Because everything after content= is in double quote, do you have any recommendation on how to replace this .Summary?
Thank you so much!
Trang
Thank you for teaching me to fish. This was a very helpful and illuminating article that had me learn a bit more about the hugo ecosystem.
I found the theme I was using called out to a {{ partial "post-summary.html" . }} so I created a copy of the original ./layouts/partials/post-summary.html from the theme into my hugo site base dir. I tried to avoid replicating the html and templating from the theme in this override customization file and just using scratch set to change the .Summary variable, but in the end I had to remove the existing {{ .Summary | safeHTML }} and swap in the code snippet in your article.
My site looks better already.
Good to know the post helped you a bit!
Sign in to join the discussion
Sign in with GitHub