From 39dac5838e1ba38c3a50824fc94c8147019a39d3 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Tue, 3 Sep 2024 11:29:01 -0700 Subject: [PATCH] Document ContentWithoutSummary --- content/en/content-management/summaries.md | 10 +++---- content/en/methods/page/Content.md | 6 ++--- .../en/methods/page/ContentWithoutSummary.md | 26 +++++++++++++++++++ content/en/methods/page/Plain.md | 4 ++- content/en/methods/page/PlainWords.md | 3 +++ content/en/methods/page/RawContent.md | 2 ++ content/en/methods/page/RenderShortcodes.md | 4 ++- 7 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 content/en/methods/page/ContentWithoutSummary.md diff --git a/content/en/content-management/summaries.md b/content/en/content-management/summaries.md index 7b81cf0a0..e0b2c9590 100644 --- a/content/en/content-management/summaries.md +++ b/content/en/content-management/summaries.md @@ -92,11 +92,11 @@ Note that the `summaryLength` is an approximate number of words. Each summary type has different characteristics: -Type|Precedence|Renders markdown|Renders shortcodes|Strips HTML tags|Wraps single lines with `

` -:--|:-:|:-:|:-:|:-:|:-: -Manual|1|:heavy_check_mark:|:heavy_check_mark:|:x:|:heavy_check_mark: -Front matter|2|:heavy_check_mark:|:x:|:x:|:x: -Automatic|3|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:x: +Type|Precedence|Renders markdown|Renders shortcodes|Wraps single lines with `

` +:--|:-:|:-:|:-:|:-: +Manual|1|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark: +Front matter|2|:heavy_check_mark:|:x:|:x: +Automatic|3|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark: ## Rendering diff --git a/content/en/methods/page/Content.md b/content/en/methods/page/Content.md index a9d38367c..373c6590a 100644 --- a/content/en/methods/page/Content.md +++ b/content/en/methods/page/Content.md @@ -5,6 +5,8 @@ categories: [] keywords: [] action: related: + - methods/page/Summary + - methods/page/ContentWithoutSummary - methods/page/RawContent - methods/page/Plain - methods/page/PlainWords @@ -13,9 +15,7 @@ action: signatures: [PAGE.Content] --- -The `Content` method on a `Page` object renders Markdown and shortcodes to HTML. The content does not include front matter. - -[shortcodes]: /getting-started/glossary/#shortcode +The `Content` method on a `Page` object renders Markdown and shortcodes to HTML. ```go-html-template {{ .Content }} diff --git a/content/en/methods/page/ContentWithoutSummary.md b/content/en/methods/page/ContentWithoutSummary.md new file mode 100644 index 000000000..112901ce1 --- /dev/null +++ b/content/en/methods/page/ContentWithoutSummary.md @@ -0,0 +1,26 @@ +--- +title: ContentWithoutSummary +description: Returns the rendered content of the given page, excluding the content summary. +categories: [] +keywords: [] +action: + related: + - methods/page/Content + - methods/page/Summary + - methods/page/RawContent + - methods/page/Plain + - methods/page/PlainWords + - methods/page/RenderShortcodes + returnType: template.HTML + signatures: [PAGE.ContentWithoutSummary] +--- + +Applicable when using manual or automatic [content summaries], the `ContentWithoutSummary` method on a `Page` object renders Markdown and shortcodes to HTML, excluding the content summary from the result. + +[content summaries]: /content-management/summaries/#manual-summary + +```go-html-template +{{ .ContentWithoutSummary }} +``` + +The `ContentWithoutSummary` method returns an empty string if you define the content summary in front matter. diff --git a/content/en/methods/page/Plain.md b/content/en/methods/page/Plain.md index 3aae1ed61..06d2bde48 100644 --- a/content/en/methods/page/Plain.md +++ b/content/en/methods/page/Plain.md @@ -6,6 +6,8 @@ keywords: [] action: related: - methods/page/Content + - methods/page/Summary + - methods/page/ContentWithoutSummary - methods/page/RawContent - methods/page/PlainWords - methods/page/RenderShortcodes @@ -13,7 +15,7 @@ action: signatures: [PAGE.Plain] --- -The `Plain` method on a `Page` object renders Markdown and [shortcodes] to HTML, then strips the HTML [tags]. It does not strip HTML [entities]. The plain content does not include front matter. +The `Plain` method on a `Page` object renders Markdown and [shortcodes] to HTML, then strips the HTML [tags]. It does not strip HTML [entities]. To prevent Go's [html/template] package from escaping HTML entities, pass the result through the [`htmlUnescape`] function. diff --git a/content/en/methods/page/PlainWords.md b/content/en/methods/page/PlainWords.md index 4f70193fe..221fd741b 100644 --- a/content/en/methods/page/PlainWords.md +++ b/content/en/methods/page/PlainWords.md @@ -6,8 +6,11 @@ keywords: [] action: related: - methods/page/Content + - methods/page/Summary + - methods/page/ContentWithoutSummary - methods/page/RawContent - methods/page/Plain + - methods/page/RenderShortcodes returnType: '[]string' signatures: [PAGE.PlainWords] --- diff --git a/content/en/methods/page/RawContent.md b/content/en/methods/page/RawContent.md index 12686c695..e4ab8a28e 100644 --- a/content/en/methods/page/RawContent.md +++ b/content/en/methods/page/RawContent.md @@ -6,6 +6,8 @@ keywords: [] action: related: - methods/page/Content + - methods/page/Summary + - methods/page/ContentWithoutSummary - methods/page/Plain - methods/page/PlainWords - methods/page/RenderShortcodes diff --git a/content/en/methods/page/RenderShortcodes.md b/content/en/methods/page/RenderShortcodes.md index a4120f69a..9679fc8d5 100644 --- a/content/en/methods/page/RenderShortcodes.md +++ b/content/en/methods/page/RenderShortcodes.md @@ -5,11 +5,13 @@ categories: [] keywords: [] action: related: - - methods/page/RenderString - methods/page/Content + - methods/page/Summary + - methods/page/ContentWithoutSummary - methods/page/RawContent - methods/page/Plain - methods/page/PlainWords + - methods/page/RenderString returnType: template.HTML signatures: [PAGE.RenderShortcodes] toc: true