diff --git a/content/en/content-management/summaries.md b/content/en/content-management/summaries.md index b9f9afd8c..2f9c4287a 100644 --- a/content/en/content-management/summaries.md +++ b/content/en/content-management/summaries.md @@ -29,14 +29,20 @@ It is natural to accompany the summary with links to the original content, and a ### 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. You may customize the summary length by setting `summaryLength` in your [site configuration](/getting-started/configuration/). +By default, Hugo automatically takes the first 70 words of your content as its summary. Access this value from a template using the [`Summary`] method on a `Page` object. You may customize the summary length by setting [`summaryLength`] in your site configuration. + +[`Summary`]: /methods/page/summary +[`summaryLength`]: /getting-started/configuration/#summarylength {{% note %}} You can customize how HTML tags in the summary are loaded using functions such as `plainify` and `safeHTML`. {{% /note %}} {{% 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/). +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. + +[`CJK`]: /getting-started/glossary/#cjk +[`hasCJKLanguage`]: /getting-started/configuration/#hascjklanguage {{% /note %}} ### Manual summary splitting @@ -63,7 +69,7 @@ Be careful to enter `` exactly; i.e., all lowercase and with no white ### Front matter summary -You might want your summary to be something other than the text that starts the article. In this case you can provide a separate summary in the `summary` variable of the article front matter. +You might want your summary to be something other than the text that starts the article. In this case you can provide a separate summary in the `summary` field in front matter. Pros : Complete freedom of text independent of the content of the article. Markup can be used within the summary. @@ -76,11 +82,11 @@ Cons Because there are multiple ways in which a summary can be specified it is useful to understand the order of selection Hugo follows when deciding on the text to be returned by `.Summary`. It is as follows: 1. If there is a `` summary divider present in the article, the text up to the divider will be provided as per the manual summary split method -2. If there is a `summary` variable in the article front matter the value of the variable will be provided as per the front matter summary method +2. If there is a `summary` field in the article front matter the value of the variable will be provided as per the front matter summary method 3. The text at the start of the article will be provided as per the automatic summary split method {{% note %}} -Hugo uses the _first_ of the above steps that returns text. So if, for example, your article has both `summary` variable in its front matter and a `` summary divider Hugo will use the manual summary split method. +Hugo uses the _first_ of the above steps that returns text. So if, for example, your article has both `summary` field in its front matter and a `` summary divider Hugo will use the manual summary split method. {{% /note %}} ## Example: first 10 articles with summaries @@ -105,8 +111,9 @@ You can show content summaries with the following code. You could use the follow {{ end }} {{< /code >}} -Note how the `.Truncated` boolean variable value may be used to hide the "Read More..." link when the content is not truncated; i.e., when the summary contains the entire article. +Note how the `Truncated` method may be used to hide the "Read More..." link when the content is not truncated; i.e., when the summary contains the entire article. +[`Truncated`]: /methods/page/truncated [`Permalink`]: /methods/page/permalink/ [`RelPermalink`]: /methods/page/relpermalink/ [`Summary`]: /methods/page/summary/ diff --git a/content/en/content-management/taxonomies.md b/content/en/content-management/taxonomies.md index 94f2f6357..4f62aebfe 100644 --- a/content/en/content-management/taxonomies.md +++ b/content/en/content-management/taxonomies.md @@ -130,26 +130,15 @@ If you want to disable all taxonomies altogether, see the use of `disableKinds` You can add content and front matter to your taxonomy list and taxonomy terms pages. See [Content Organization](/content-management/organization/) for more information on how to add an `_index.md` for this purpose. {{% /note %}} -## Add taxonomies to content +## Assign terms to content -Once a taxonomy is defined at the site level, any piece of content can be assigned to it, regardless of [content type] or [content section]. - -Assigning content to a taxonomy is done in the [front matter]. Simply create a variable with the *plural* name of the taxonomy and assign all terms you want to apply to the instance of the content type. - -{{% note %}} -If you would like the ability to quickly generate content files with preconfigured taxonomies or terms, read the docs on [Hugo archetypes](/content-management/archetypes/). -{{% /note %}} - -### Example: front matter with taxonomies +To assign one or more terms to a page, create a front matter field using the plural name of the taxonomy, then add terms to the corresponding array. For example: {{< code-toggle file=content/example.md fm=true >}} -title = "Hugo: A fast and flexible static site generator" -tags = [ "Development", "Go", "fast", "Blogging" ] -categories = [ "Development" ] -series = [ "Go Web Dev" ] -slug = "hugo" -project_url = "https://github.com/gohugoio/hugo" -{{}} +title = 'Example' +tags = ['Tag A','Tag B'] +categories = ['Category A','Category B'] +{{< /code-toggle >}} ## Order taxonomies diff --git a/content/en/content-management/toc.md b/content/en/content-management/toc.md deleted file mode 100644 index 6efa9e3cd..000000000 --- a/content/en/content-management/toc.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -title: Table of contents -description: Hugo can automatically parse Markdown content and create a Table of Contents you can use in your templates. -categories: [content management] -keywords: [table of contents, toc] -menu: - docs: - parent: content-management - weight: 210 -weight: 210 -toc: true -aliases: [/extras/toc/] ---- - -{{% note %}} - -Previously, there was no out-of-the-box way to specify which heading levels you want the TOC to render. [See the related GitHub discussion (#1778)](https://github.com/gohugoio/hugo/issues/1778). As such, the resulting `` was going to start at `

` when pulling from `{{ .Content }}`. - -Hugo [v0.60.0](https://github.com/gohugoio/hugo/releases/tag/v0.60.0) made a switch to [Goldmark](https://github.com/yuin/goldmark/) as the default library for Markdown which has improved and configurable implementation of TOC. Take a look at [how to configure TOC](/getting-started/configuration-markup/#table-of-contents) for Goldmark renderer. - -{{% /note %}} - -## Usage - -Create your Markdown the way you normally would with the appropriate headings. Here is some example content: - -```md - - -## Introduction - -One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. - -## My Heading - -He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections. The bedding was hardly able to cover it and seemed ready to slide off any moment. - -### My Subheading - -A collection of textile samples lay spread out on the table - Samsa was a traveling salesman - and above it there hung a picture that he had recently cut out of an illustrated magazine and housed in a nice, gilded frame. It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer. Gregor then turned to look out the window at the dull weather. Drops -``` - -Hugo will take this Markdown and create a table of contents from `## Introduction`, `## My Heading`, and `### My Subheading` and then store it in the [page variable][pagevars]`.TableOfContents`. - -The `.TableOfContents` method on a `Page` object outputs a `