HUGO
Menu
GitHub 90265 stars Mastodon

RawSummary

Returns the summary of the given page as defined in front matter, without rendering Markdown.
Syntax
PAGE.RawSummary
Returns
string

Usage

The RawSummary method on a Page object returns the summary of the given page as defined in front matter, without rendering Markdown.

New in v0.169.0

You can define a summary manually, in front matter, or automatically. The RawSummary method returns only a front matter summary. If you define the summary manually or automatically, the method returns an empty string. To render the summary regardless of how you define it, use the Summary method on a Page object.

Examples

These examples use this front matter:

---
summary: A **bold** word.
title: Example
---
+++
summary = 'A **bold** word.'
title = 'Example'
+++
{
   "summary": "A **bold** word.",
   "title": "Example"
}
{{ .RawSummary }} → A **bold** word.

Rendering Markdown with the transform.Markdownify function, showing the raw HTML output:

{{ .RawSummary | markdownify }} → A <strong>bold</strong> word.

Falling back to the page description when the front matter summary is not defined:

{{ with .RawSummary }}
  {{ . | markdownify }}
{{ else }}
  {{ .Description }}
{{ end }}