From 96287a20a122aed704b33bfffcdb1100dcccebfa Mon Sep 17 00:00:00 2001 From: Bangel Date: Wed, 12 Sep 2018 15:51:17 -0500 Subject: [PATCH] Add config option "summaryLength" (#600) * Add config option "summaryLength" *Updated to include "summaryLength" configuration option from https://github.com/gohugoio/hugo/pull/3924 *Took line about HTML loading in summary and updated it to clarify the user has options to show html or not instead of implying there are no options *Fixed typos @kaushalmodi moved the Org mode `# more` syntax sentence to a new paragraph. --- content/en/content-management/summaries.md | 28 ++++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/content/en/content-management/summaries.md b/content/en/content-management/summaries.md index bf2f0fec8..63d64aa3c 100644 --- a/content/en/content-management/summaries.md +++ b/content/en/content-management/summaries.md @@ -21,28 +21,30 @@ With the use of the `.Summary` [page variable][pagevariables], Hugo generates su ## Summary Splitting Options -* Hugo-defined Summary Split -* User-defined Summary Split +* Automatic Summary Split +* Manual Summary Split It is natural to accompany the summary with links to the original content, and a common design pattern is to see this link in the form of a "Read More ..." button. See the `.RelPermalink`, `.Permalink`, and `.Truncated` [page variables][pagevariables]. -### Hugo-defined: Automatic Summary Splitting +### Automatic Summary Splitting -By default, Hugo automatically takes the first 70 words of your content as its summary and stores it into the `.Summary` page variable for use in your templates. Taking the Hugo-defined approach to summaries may save time, but it has pros and cons: - -Pros -: Automatic, no additional work on your part. - -Cons -: All HTML tags are stripped from the summary, and the first 70 words, whether they belong to a heading or to different paragraphs, are all put into one paragraph. +By default, Hugo automatically takes the first 70 words of your content as its summary and stores it into the `.Summary` page variable for use in your templates. You may customize the summary length by setting `summaryLength` in your [site configuration](/getting-started/configuration/). {{% note %}} -The Hugo-defined summaries are set to use word count calculated by splitting the text by one or more consecutive white space characters. If you are creating content in a `CJK` language and want to use Hugo's automatic summary splitting, set `hasCJKLanguage` to `true` in you [site configuration](/getting-started/configuration/). +You can customize how HTML tags in the summary are loaded using functions such as `plainify` and `safeHTML`. {{% /note %}} -### User-defined: Manual Summary Splitting +{{% note %}} +The Hugo-defined summaries are set to use word count calculated by splitting the text by one or more consecutive whitespace characters. If you are creating content in a `CJK` language and want to use Hugo's automatic summary splitting, set `hasCJKLanguage` to `true` in your [site configuration](/getting-started/configuration/). +{{% /note %}} -Alternatively, you may add the <!--more--> summary divider where you want to split the article. For [org content][org], use `# more` where you want to split the article. Content that comes before the summary divider will be used as that content's summary and stored in the `.Summary` page variable with all HTML formatting intact. +### Manual Summary Splitting + +Alternatively, you may add the <!--more--> summary divider where you want to split the article. + +For [Org mode content][org], use `# more` where you want to split the article. + +Content that comes before the summary divider will be used as that content's summary and stored in the `.Summary` page variable with all HTML formatting intact. {{% note "Summary Divider"%}} The concept of a *summary divider* is not unique to Hugo. It is also called the "more tag" or "excerpt separator" in other literature.