7
0
Fork 0

Fix: sommige secties/pagina's werden dubbel getoond in sitemap

This commit is contained in:
Michael Boelen 2023-05-21 11:04:42 +02:00
parent 3652aea2ab
commit ae447e0220
2 changed files with 16 additions and 14 deletions

View file

@ -3,22 +3,13 @@
<div>{{ .Content }}</div> <div>{{ .Content }}</div>
<h2>Secties</h2> <h2>Secties</h2>
{{ $sections := (where $.Site.Pages ".Kind" "section").ByTitle }}
{{ range $.Site.Sections.ByTitle }}
{{ range $sections }} <h3><a href="{{ .RelPermalink }}">{{ .Title | default .Site.Params.textNoTitle }}</a></h3>
<h3><a href="{{ .Permalink }}">{{ .Title | default .Site.Params.textNoTitle }}</a></h3> {{ partial "recursive-pages.html" . }}
{{ $sectionName := .Section | singularize }}
{{ $pages := (where $.Site.RegularPages ".Section" $sectionName) }}
<ul>
{{ range $pages.ByParam "title" }}
<li>
<a href="{{ .RelPermalink }}">{{ .Title | default .Site.Params.textNoTitle }}</a>
</li>
{{ end }}
</ul>
{{ end }} {{ end }}
<h2>Laatste wijzigingen</h2> <h2>Laatste wijzigingen</h2>
{{ $byLastMod := .Site.RegularPages.ByLastmod.Reverse }} {{ $byLastMod := .Site.RegularPages.ByLastmod.Reverse }}
<div class="table-wrapper"> <div class="table-wrapper">
@ -34,7 +25,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{ range first 50 $byLastMod }} {{ range first 20 $byLastMod }}
<tr> <tr>
<td>{{ .Lastmod | dateFormat "2006-01-02 15:04:05" }}</td> <td>{{ .Lastmod | dateFormat "2006-01-02 15:04:05" }}</td>
<td><a href="{{ .RelPermalink }}">{{ .Title }}</a></td> <td><a href="{{ .RelPermalink }}">{{ .Title }}</a></td>

View file

@ -0,0 +1,11 @@
{{ $child_pages := union .Sections .Pages }}
<ul>
{{ range $child_pages.ByTitle }}
<li>
<a href="{{ .RelPermalink }}"> {{ .Title }} </a>
{{ if or (.Sections) (.Pages) }}
{{ partial "recursive-pages.html" . }}
{{ end }}
</li>
{{ end }}
</ul>