Summary on home page

Method 1

This approach essentially disables automatic summary splitting on your site. In your site configuration:

summaryLength = 999999 # Tolstoy's War and Peace has around 600000 words.

Then in your template you can do:

{{ .Summary }}

This will return a stripped version of .Content unless you (a) manually split the summary with the <!--more--> tag, or (b) define the summary in front matter.

Method 2 (recommended)

Parse the raw content for the <!--more--> tag.

{{ if or (findRE `<!--more-->` .RawContent) .Params.Summary }}
  {{ .Summary }}
{{ else }}
  {{ .Content }}
{{ end }}

This will return .Content unless you (a) manually split the summary with the <!--more--> tag, or (b) define the summary in front matter.

2 Likes