|
6 | 6 | {{- define "content" -}}
|
7 | 7 | {{- $params := partial "function/params.html" -}}
|
8 | 8 | {{- $fingerprint := .Scratch.Get "fingerprint" -}}
|
| 9 | + {{- $pages := .Pages -}} |
| 10 | + {{- $hiddenAdapters := .Param "hiddenAdapters" | default false -}} |
| 11 | + {{- if $hiddenAdapters -}} |
| 12 | + {{- $pages = where $pages "File.IsContentAdapter" "ne" true -}} |
| 13 | + {{- end -}} |
9 | 14 | {{- $data := index .Site.Data (printf "projects.%v" .Language) | default .Site.Data.projects -}}
|
10 | 15 | {{- $toc := .Scratch.Get "toc" -}}
|
11 | 16 | {{- $tableOfContents := .Fragments.ToHTML ($toc.startlevel | int) ($toc.endlevel | int) false -}}
|
12 | 17 | {{- $contentToc := ne $tableOfContents `<nav id="TableOfContents"></nav>` -}}
|
13 |
| - {{- $hasToc := $contentToc | or (gt (len $data) 0) | or (gt .Pages.Len 0) -}} |
| 18 | + {{- $hasToc := $contentToc | or (gt (len $data) 0) | or (gt (len $pages) 0) -}} |
14 | 19 | {{- $showToc := $toc.enable | and $hasToc -}}
|
| 20 | + {{- $localData := newScratch -}} |
| 21 | + {{- $pageCount := 0 -}} |
15 | 22 | {{- /* Paginate before content */ -}}
|
16 |
| - {{- $pages := .Pages -}} |
17 |
| - {{- $hiddenAdapters := .Param "hiddenAdapters" | default false -}} |
18 |
| - {{- if $hiddenAdapters -}} |
19 |
| - {{- $pages = where $pages "File.IsContentAdapter" "ne" true -}} |
20 |
| - {{- end -}} |
21 | 23 | {{- if $pages -}}
|
| 24 | + {{- $pageCount = $pages.Len -}} |
| 25 | + {{- /* Total page and word count */ -}} |
| 26 | + {{- range $pages -}} |
| 27 | + {{- $localData.Add "totalWordCount" .WordCount -}} |
| 28 | + {{- end -}} |
22 | 29 | {{- $pages = $pages.GroupByDate "2006" -}}
|
23 | 30 | {{- with .Site.Params.section.paginate | default .Site.Params.paginate -}}
|
24 | 31 | {{- $pages = $.Paginate $pages . -}}
|
@@ -77,7 +84,7 @@ <h1 class="single-title animate__animated animate__pulse animate__faster">
|
77 | 84 | {{- $tocFromData = add $tocFromData (printf "<li><a href=\"#%v\">%v</a></li>" ($group.title | anchorize) $group.title) -}}
|
78 | 85 | {{- end -}}
|
79 | 86 | {{- end -}}
|
80 |
| - {{- if .Pages -}} |
| 87 | + {{- if $pages -}} |
81 | 88 | {{- $tocFromData = add $tocFromData (printf "<li><a href=\"#related-articles\">%v</a></li>" (T "projects.relatedArticles")) -}}
|
82 | 89 | {{- end -}}
|
83 | 90 | {{- with $tocFromData -}}
|
@@ -151,19 +158,14 @@ <h2 id="{{ $group.title | anchorize }}" class="heading-element">
|
151 | 158 | </div>
|
152 | 159 | {{- end -}}
|
153 | 160 | <hr class="awesome-hr">
|
154 |
| - {{- if .Pages -}} |
| 161 | + {{- if $pages -}} |
155 | 162 | <h2 id="related-articles" class="heading-element">
|
156 | 163 | <span>{{ T "projects.relatedArticles" }}</span>
|
157 | 164 | <a href="#related-articles" class="heading-mark"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a>
|
158 | 165 | </h2>
|
159 |
| - {{- /* Total page and word count */ -}} |
160 |
| - {{- $localData := newScratch -}} |
161 |
| - {{- range .Pages -}} |
162 |
| - {{- $localData.Add "totalWordCount" .WordCount -}} |
163 |
| - {{- end -}} |
164 | 166 | {{- with ($localData.Get "totalWordCount") -}}
|
165 |
| - <div title="{{- T `section.archiveCounter` $.Pages.Len }} {{ T `section.totalWordCount` . }}" class="group-summary"> |
166 |
| - {{- T "section.archiveCounter" $.Pages.Len }} & {{ T "section.totalWordCount" (dict "Count" (partial "function/format-number" (dict "NUMBER" .))) -}} |
| 167 | + <div title="{{- T `section.archiveCounter` $pageCount }} {{ T `section.totalWordCount` . }}" class="group-summary"> |
| 168 | + {{- T "section.archiveCounter" $pageCount }} & {{ T "section.totalWordCount" (dict "Count" (partial "function/format-number" (dict "NUMBER" .))) -}} |
167 | 169 | </div>
|
168 | 170 | {{- end -}}
|
169 | 171 | {{- with $params.sectionSlot -}}
|
|
0 commit comments