Skip to content

Commit

Permalink
Improve sitemap
Browse files Browse the repository at this point in the history
  • Loading branch information
sebousan committed Mar 26, 2024
1 parent 200efc7 commit c762542
Showing 1 changed file with 29 additions and 30 deletions.
59 changes: 29 additions & 30 deletions layouts/partials/sitemap/content.html
Original file line number Diff line number Diff line change
@@ -1,47 +1,46 @@
<div class="content">
{{ range (where site.Sections ".Params.isPage" "!=" true) }}
{{ if ne .Type "sitemap" }}
{{ $permalink := .Permalink }}
<h2 id="{{ .Type }}">
<a href="{{ $permalink }}">{{ partial "func/PrepareHTML" .Title }}</a>
</h2>
<ul>
{{ range where .Site.Pages "Section" .Type }}
{{ if ne $permalink .Permalink }}
<li>
<a href="{{ .Permalink }}">{{ partial "func/PrepareHTML" .Title }}</a>
{{ if or (eq .Type "posts") (eq .Type "publications") }}
- <time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}" itemprop="datePublished">{{ .Date | time.Format ":date_medium" }}</time>
{{ end }}
</li>
{{ end }}
{{ end }}
</ul>
{{ end }}
{{ end }}
{{ $pages := where site.Sections ".Params.isPage" true }}
{{ if $pages }}
<h2 id="pages">{{ i18n "pages.title" ($pages | len) }}</h2>
<ul>
{{ range $pages }}
{{ $permalink := .Permalink }}
<li id="{{ .Type }}">
<div class="sitemap-{{ .Type }}">
{{- $permalink := .Permalink -}}
<h2 id="{{ .Type }}">
<a href="{{ $permalink }}">{{ partial "func/PrepareHTML" .Title }}</a>
</li>
</h2>
<ul>
{{ range where .Site.Pages "Section" .Type }}
{{ if ne $permalink .Permalink }}
<li>
<a href="{{ .Permalink }}">{{ partial "func/PrepareHTML" .Title }}</a>
{{ if eq .Type "posts" }}
{{ if or (eq .Type "posts") (eq .Type "publications") }}
- <time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}" itemprop="datePublished">{{ .Date | time.Format ":date_medium" }}</time>
{{ end }}
</li>
{{ end }}
{{ end }}
</ul>
{{ end }}
</ul>
</div>
{{ end }}
{{ end }}
{{- $pages := where site.Sections ".Params.isPage" true -}}
{{ if $pages }}
<div class="sitemap-pages">
<h2 id="pages">{{ i18n "pages.title" ($pages | len) }}</h2>
<ul>
{{ range $pages }}
<li>
<a href="{{ .Permalink }}">{{ partial "func/PrepareHTML" .Title }}</a>
</li>
{{ with .Pages }}
<ul>
{{ range . }}
<li>
<a href="{{ .Permalink }}">{{ partial "func/PrepareHTML" .Title }}</a>
</li>
{{ end }}
</ul>
{{ end }}
{{ end }}
</ul>
</div>
{{ end }}

</div>

0 comments on commit c762542

Please sign in to comment.