How to disable the summary for a post?

I would like to manually manage the summaries of my posts.

While using summary in the front matter allows to set a summary, it is not possible to create an empty one: the first 70 characters of the post are used in that case.

I also tried to reduce summaryLength to 0 in the config file but it seems to not have any effect.

Is there a way to disable the summary for a given post? Or, alternatively, disable it for the whole blog, and only use summary from the front matter.

Option 1

Set summary to " " in front matter (single space).

Option 2

In front matter use the description field, and inject this field instead of summary when creating list pages, meta description in head, etc. For example, in /layouts/_default/list.html:

{{- range .Pages }}
  <h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
  <p>
  {{- with .Description -}}
    {{- . | markdownify -}}
  {{- end -}}
  </p>
{{ end }}
1 Like

This is perfect, thank you.

Your solution 2 is very good too, it also helped me to learn more about templating.

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