Afegida paginació i configuarció del tema.

This commit is contained in:
2021-10-30 15:08:55 +02:00
parent 1c27c481cd
commit c2b72e32f0
8 changed files with 102 additions and 6 deletions

View File

@@ -0,0 +1,57 @@
{{ define "main" }}
<div class="post">
<h1 class="post-title">
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1>
<div class="post-meta">
{{ if .Params.Date }}
<span class="post-date">
{{ .Date.Format "2006-01-02" }} {{ if $.Site.Params.showLastUpdated }}[{{or $.Site.Params.updatedDatePrefix "Updated"}}: {{ .Lastmod.Format "2006-01-02" }}]{{ end }}
</span>
{{ end }}
{{ with .Params.Author }}
<span class="post-author">:: {{ . }}</span>
{{ end }}
</div>
{{ if .Params.tags }}
<span class="post-tags">
{{ range .Params.tags }}
#<a href="{{ (urlize (printf "tags/%s/" .)) | absLangURL }}">{{ . }}</a>&nbsp;
{{ end }}
</span>
{{ end }}
{{ if .Params.Cover }}
<img src="{{ .Params.Cover | absURL }}" class="post-cover" alt="{{ .Title | plainify | default " " }}" />
{{ end }}
{{ if .Params.Toc }}
<div class="table-of-contents">
<h2>
{{ if .Params.TocTitle }}
{{ .Params.TocTitle }}
{{ else if $.Site.Params.TocTitle }}
{{ $.Site.Params.TocTitle }}
{{ else }}
Table of Contents
{{ end }}
</h2>
{{ .TableOfContents }}
</div>
{{ end }}
<div class="post-content">
{{- with .Content -}}
<div>
{{ . | replaceRE "(<h[1-9] id=\"([^\"]+)\".+)(</h[1-9]+>)" `${1}<a href="#${2}" class="hanchor" ariaLabel="Anchor">&#8983;</a> ${3}` | safeHTML }}
</div>
{{- end -}}
</div>
{{ if eq .Type $.Site.Params.postTypeName }}
{{ partial "posts_pagination.html" . }}
{{ end }}
{{ partial "comments.html" . }}
</div>
{{ end }}

View File

@@ -0,0 +1,26 @@
{{ if or .NextInSection .PrevInSection }}
<div class="pagination">
<div class="pagination__title">
<span class="pagination__title-h">{{ $.Site.Params.ReadOtherPosts }}</span>
<hr />
</div>
<div class="pagination__buttons">
{{ if .PrevInSection }}
<span class="button previous">
<a href="{{ .PrevInSection.Permalink }}">
<span class="button__icon"></span>
<span class="button__text">{{ .PrevInSection.Title }}</span>
</a>
</span>
{{ end }}
{{ if .NextInSection }}
<span class="button next">
<a href="{{ .NextInSection.Permalink }}">
<span class="button__text">{{ .NextInSection.Title }}</span>
<span class="button__icon"></span>
</a>
</span>
{{ end }}
</div>
</div>
{{ end }}