Show a summary ONLY if a <!--more--> comment exists

Very rarely, I’d like to show only a summary on my blog’s front page. I only want to do so if I have provided a <!--more--> comment to truncate the post. I am puzzled as to how to get a summary only if that comment exists. Is there an easy way to do this?

{{ range .Site.RegularPages }}
  <h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
  {{ if findRE `<!--more-->` .RawContent }}
    {{ .Summary }}
  {{ end }}
{{ end }}

Thanks very much. .RawContent is what I was missing.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.