Problem with the .Truncated method returning true when it shouldn't

I’m having a problem with the .Truncated method.

I have a page that has a single paragraph that has more words than summaryLength.

When I render the .Summary of this page on my list page, .Truncated returns true, even though all of the content is rendered (this is because .Summary returns content truncated at the paragraph boundary, and there’s only one paragraph). This results in showing the “More details” link, even though the page doesn’t have any more content.

For example:

# content/section/page.md
---
title: My page
---
A paragraph that has more words than summaryLength.
# content/section/_index.md
{{ range .Pages }}
  {{ .Summary }}
  {{ if .Truncated }}
    <a href="{{ .RelPermalink }}">
      More details
    </a>
  {{ end }}
{{ end }}

I tried using the <!--more--> divider at the very end of the page, but this still results in .Truncated returning true. Not sure why that should be the case either.

Is this a bug? And are there any other ways I could display the “More details” link only when there is actually more content to be seen? I am thinking about comparing the summary and content, but this seems a little gross.

{{ if ne (chomp .Summary) (chomp .Content) }}

Yes, there are some bugs here:

  1. https://github.com/gohugoio/hugo/issues/13967
  2. https://github.com/gohugoio/hugo/issues/13968

Thanks for confirming.

https://github.com/gohugoio/hugo/pull/13969