mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-22 21:42:50 +02:00
Merge commit '5e078383a787e8b5ec3ba73f05ea4130840afbe2'
This commit is contained in:
@@ -43,10 +43,11 @@ You may want to append a class to a heading according to the length of the strin
|
||||
|
||||
## `len` Example 2: Counting Pages with `where`
|
||||
|
||||
The following templating uses [`where`][] in conjunction with `len` to figure out the total number of content pages in a `posts` [section][]:
|
||||
The following templating uses [`where`][] in conjunction with `len` to
|
||||
figure out the total number of content pages in a `posts` [section][]:
|
||||
|
||||
{{< code file="how-many-posts.html" >}}
|
||||
{{ $posts := (where .Site.RegularPages "Section" "==" "post") }}
|
||||
{{ $posts := (where .Site.RegularPages "Section" "==" "posts") }}
|
||||
{{ $postCount := len $posts }}
|
||||
{{< /code >}}
|
||||
|
||||
|
Reference in New Issue
Block a user