mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
Merge commit '5e078383a787e8b5ec3ba73f05ea4130840afbe2'
This commit is contained in:
@@ -74,7 +74,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" download="toc.html" >}}
|
||||
{{ if and (gt .WordCount 400 ) (ne .Params.toc "false") }}
|
||||
{{ if and (gt .WordCount 400 ) (.Params.toc) }}
|
||||
<aside>
|
||||
<header>
|
||||
<h2>{{.Title}}</h2>
|
||||
@@ -92,4 +92,4 @@ With the preceding example, even pages with > 400 words *and* `toc` not set to `
|
||||
[front matter]: /content-management/table-of-contents/
|
||||
[pagevars]: /variables/page/
|
||||
[partials]: /templates/partials/
|
||||
[single page template]: /templates/single-page-templates/
|
||||
[single page template]: /templates/single-page-templates/
|
||||
|
Reference in New Issue
Block a user