diff options
Diffstat (limited to 'docs/content/en/content-management/toc.md')
-rw-r--r-- | docs/content/en/content-management/toc.md | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/docs/content/en/content-management/toc.md b/docs/content/en/content-management/toc.md index ca179c77d..69021ac45 100644 --- a/docs/content/en/content-management/toc.md +++ b/docs/content/en/content-management/toc.md @@ -7,8 +7,8 @@ menu: docs: parent: content-management weight: 210 -toc: true weight: 210 +toc: true aliases: [/extras/toc/] --- @@ -37,7 +37,7 @@ He lay on his armour-like back, and if he lifted his head a little he could see ### My Subheading -A collection of textile samples lay spread out on the table - Samsa was a travelling 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 +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`. @@ -48,7 +48,7 @@ The built-in `.TableOfContents` variables outputs a `<nav id="TableOfContents">` The following is an example of a very basic [single page template]: -{{< code file="layout/_default/single.html" >}} +{{< code file=layout/_default/single.html >}} {{ define "main" }} <main> <article> @@ -68,7 +68,7 @@ The following is an example of a very basic [single page template]: The following is a [partial template][partials] that adds slightly more logic for page-level control over your table of contents. It assumes you are using a `toc` field in your content's [front matter] that, unless specifically set to `false`, will add a TOC to any page with a `.WordCount` (see [Page Variables][pagevars]) greater than 400. This example also demonstrates how to use [conditionals] in your templating: -{{< code file="layouts/partials/toc.html" >}} +{{< code file=layouts/partials/toc.html >}} {{ if and (gt .WordCount 400 ) (.Params.toc) }} <aside> <header> @@ -105,8 +105,9 @@ He lay on his armour-like back, and if he lifted his head a little he could see === My Subheading -A collection of textile samples lay spread out on the table - Samsa was a travelling 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 +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 AsciiDoc and create a table of contents store it in the page variable `.TableOfContents`, in the same as described for Markdown. [conditionals]: /templates/introduction/#conditionals |