HUGO

How to avoid excluding .Summary from post .Content?

Creating post with manual summary divider. With main index.html template

{{ range first 10 .Pages }}
    <h1>{{ .Title  | safeHTML }}</h1>
    {{ .Summary }}
    {{ if .Truncated }}
    <div>
        <a href="{{ .RelPermalink }}">Read more »</a>
    </div>
    {{ end }}
{{ end }}

got what I want - list of summaries. But on single page with code in single.html

<h1>{{ .Title | safeHTML }}</h1>
{{ .Content }}

summary not showing and I need to duplicate summary after tag to show complete post. Is there a way to display content with summary part?

Please post an example of your markdown, including front matter.

Here is complete content of minimal content/post.html reproducing my problem. On title page I see part before <!--more--> and on post page see only last paragraph.

---

title: "My First Title"

---

<div class="credits">Author: <a href="#">Myself</a></div>

<figure>

<img class="full-width" src="/photos/2021-02/wedding-01.jpg" alt="At the beginning">

<figcaption>Clara and me at the beginning</figcaption>

</figure>

<p>Lorem ipsum paragraph&nbsp;1 - before summary end</p>

<!--more-->

<p>Lorem ipsum para&shy;graph 2 - after summary end</p>

The workaround is to use for posts markdown *.md files with html inserts when classes, semantic tags or other specific stuff needed. But such mixed files looking ugly and less compatible with processing libraries than pure html or pure md. So it should be good if Hugo will treat manual summary division in .html same way as in .md files

PS: I use Hugo 0.82 extended

This is a known issue:

1 Like

Well, so I’m not insane :slight_smile: Hope it should be fixed soon.