Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions src/config/_default/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,25 @@ enableGitInfo = true

# FIXME: klären, ob das lokal auskommentiert werden kann, weil ich in build.sh ja lastmod mitgebe...
[frontmatter]
lastmod = ["lastmod", ":git", "date", "publishDate"]
lastmod = ["lastmod", ":git", "date", "publishDate"]

[sitemap]
changeFreq = 'daily'
filename = 'sitemap.xml'
priority = 0.5
changeFreq = 'daily'
filename = 'sitemap.xml'
priority = 0.5

[outputs]
home = ["HTML", "RSS", "JSON", "post-sitemap", "page-sitemap"]
home = ["HTML", "RSS", "JSON", "post-sitemap", "page-sitemap"]

[outputFormats.post-sitemap]
baseName = 'post-sitemap'
mediaType = 'application/xml'
noUgly = true
baseName = 'post-sitemap'
mediaType = 'application/xml'
noUgly = true

[outputFormats.page-sitemap]
baseName = 'page-sitemap'
mediaType = 'application/xml'
noUgly = true
baseName = 'page-sitemap'
mediaType = 'application/xml'
noUgly = true

[pagination]
pagerSize = 15
8 changes: 7 additions & 1 deletion src/themes/seatable/layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ <h1 class="mt-1 xl:text-8xl lg:text-6xl text-4xl leading-narrow font-bold">{{ .T
<div class="mt-14 flex flex-col">

<div id="container" class="flex flex-col w-full justify-between">
{{ range $index, $page := .Pages }}
{{ $pages := .Pages }}
{{ $paginator := .Paginate $pages.ByDate.Reverse }}

<!-- Pagination size is defined in config/hugo.toml -->
{{ range $index, $page := $paginator.Pages }}
{{ if eq $index 0 }}
<!-- First item -->
<a href="{{ .RelPermalink }}">
Expand Down Expand Up @@ -63,6 +67,8 @@ <h2 class="lg:text-4xl text-2xl">{{ $page.Title }}</h2>
{{ end }}

{{ end }}

{{ partial "pagination.html" . }}
</div>
</div>
</section>
Expand Down
57 changes: 57 additions & 0 deletions src/themes/seatable/layouts/partials/pagination.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{{- $page := . }}
{{ $classes := "ms-0 flex h-10 items-center justify-center rounded-s-lg border border-e-0 border-gray-300 bg-white px-4 leading-tight text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white" }}

{{- if gt $page.Paginator.TotalPages 1 }}
<ul class="mt-10 inline-flex h-10 items-center justify-center -space-x-px text-base">
{{- with .Paginator }}
{{- $currentPageNumber := .PageNumber }}

{{- with .First }}
{{- if ne $currentPageNumber .PageNumber }}
<li class="page-item">
<a href="{{ .URL }}" aria-label="First" class="{{ $classes }}" role="button"><span aria-hidden="true">&laquo;&laquo;</span></a>
</li>
{{- end }}
{{- end }}

{{- with .Prev }}
<li class="page-item">
<a href="{{ .URL }}" aria-label="Previous" class="{{ $classes }}" role="button"><span aria-hidden="true">&laquo;</span></a>
</li>
{{- end }}

{{- $slots := 3 }}
{{- $start := math.Max 1 (sub .PageNumber (math.Floor (div $slots 2))) }}
{{- $end := math.Min .TotalPages (sub (add $start $slots) 1) }}
{{- if lt (add (sub $end $start) 1) $slots }}
{{- $start = math.Max 1 (add (sub $end $slots) 1) }}
{{- end }}

{{- range $k := seq $start $end }}
{{- if eq $.Paginator.PageNumber $k }}
<li class="page-item active">
<a aria-current="page" aria-label="Page {{ $k }}" class="{{ $classes }}" role="button">{{ $k }}</a>
</li>
{{- else }}
<li class="page-item">
<a href="{{ (index $.Paginator.Pagers (sub $k 1)).URL }}" aria-label="Page {{ $k }}" class="{{ $classes }}" role="button">{{ $k }}</a>
</li>
{{- end }}
{{- end }}

{{- with .Next }}
<li class="page-item">
<a href="{{ .URL }}" aria-label="Next" class="{{ $classes }}" role="button"><span aria-hidden="true">&raquo;</span></a>
</li>
{{- end }}

{{- with .Last }}
{{- if ne $currentPageNumber .PageNumber }}
<li class="page-item">
<a href="{{ .URL }}" aria-label="Last" class="{{ $classes }}" role="button"><span aria-hidden="true">&raquo;&raquo;</span></a>
</li>
{{- end }}
{{- end }}
{{- end }}
</ul>
{{- end }}