hi all,
i’m probably doing something stupid but i’m just not seeing it…
my index.html includes a partial template summary.html and said summary template uses {{ .Summary }} to show a preview of the post.
this has always worked fine with my html content.
However now I made a post in markdown format, which successfully renders as html when viewed in full, but doesn’t show properly in the summary in index.html, the markdown list syntax is ignored, it’s basically just “straight” plaintext.
If you want to keep the formatting you have to manually insert the split after the summary (i have this in all my archetypes so I do not have to remember the syntax):
On a blog I’m working on now, I did not like either the auto-rendered summary or the result of putting <!--more--> after what I want for the summary, so I specify the summary in a frontmatter tag and display that instead.
you’re right. the <!--more--> works fine. i can insert it at arbitrary points within the list and the markdown will render properly in the summary as a valid list (i thought perhaps the </ul> would be missing, breaking the layout of the content below but that’s not the case.).
Reading the summaries docs again it makes a lot more sense now. thanks
Yeah, that should work basically, but summary is probably a special or blessed word within Hugo, so you might use another string for the arbitrary one, like postsummary or whatever.
{{ with .Params.title_lead }}<h3 class="post-title-lead">{{ . | markdownify }}</h3>{{ end }}
<h1 class="post-title">{{ with .Params.title_main}}{{ . | markdownify }}{{ else }}{{ title .Title }}{{end}}</h1>
This is the title section of my _default/single.html on one of my sites.
Here I fall back to the builtin .Title, but sometimes I want a title that spans multiple lines or with special formatting (make one word italic …) etc. And in some articles I add what I call a title_lead to prefix the title.
Markdown support looks to be slightly broken in the context of summaries. It appears that if you have any links in your summary that make use of a reference section at the bottom of the post, then those links aren’t populated.
I had the same problem, it seems that Hugo first splits the markdown content by helpers.SummaryDivider or <!--more-->, applies shortcodes and then finally renders it with helpers.BytesToHTML. So the reference links at the bottom of the page are not part of the summary when it is converted.
just wanted to say, that I have also the “problem”. The author from my favorite theme (mainroad), told me the same, that it is for now not possible to have a summary with styles. I have often only two or three sentences with a link or a short command.
It did not find it usefull, to put every the<!--more-->, also to add it to my imported Wordpress posts. So it would be great to have summary but with CSS/Mardown enabled