add paginator for home page; update social footers; change meta check logic

This commit is contained in:
loikein 2023-04-25 14:43:15 +01:00
parent 2423e3fc37
commit 2ce906cb31
3 changed files with 63 additions and 39 deletions

View file

@ -1,26 +1,54 @@
{{ define "main" }}
<article id="main" class="home-page">
{{ partial "brand.html" . }}
{{ with .Content }}
<section>
{{ . }}
</section>
{{ end }}
<section class="page-list">
{{ range .Site.RegularPages }}
{{/* range where .Site.RegularPages "Type" "posts" */}}
{{ if ne .Draft true}}
<h2 class="content-title">
{{ if .IsNode }}
<a href="{{ .Permalink }}">{{ .Title}}</a>
{{ else }}
<a href="{{ .RelPermalink }}">{{ .Title }}{{ if .Draft }} :: Draft {{end}}</a>
{{ end }}
</h1>
<p>{{ truncate 140 .Summary }}</p>
{{ end }}
{{ end }}
{{ partial "brand.html" . }}
{{ with .Content }}
<section>
{{ . }}
</section>
{{ partial "footer.html" . }}
{{ end }}
<section class="page-list">
{{ range (.Paginate .Site.RegularPages).Pages }}
{{/* range where .Site.RegularPages "Type" "posts" */}}
{{ if ne .Draft true}}
<h2 class="content-title">
{{ if .IsNode }}
<a href="{{ .Permalink }}">{{ .Title}}</a>
{{ else }}
<a href="{{ .RelPermalink }}">{{ .Title }}{{ if .Draft }} :: Draft {{end}}</a>
{{ end }}
</h2>
{{ if .Description }}
<p>{{ .Description }}</p>
{{ else }}
<p>{{ truncate 140 .Summary }}</p>
{{ end }}
{{ end }}
{{ end }}
</section>
{{ if and (.Paginator) (gt .Paginator.TotalPages 1) }}
<hr />
<span class="previous-page">
{{ if .Paginator.HasPrev }}
<a class="link-reverse" href="{{.Paginator.Prev.URL}}">«</a>
{{ end }}
</span>
<span class="pagination-indicator">
{{.Paginator.PageNumber}} / {{.Paginator.TotalPages}}
</span>
<span class="next-page">
{{ if .Paginator.HasNext }}
<a class="link-reverse" href="{{.Paginator.Next.URL}}">»</a>
{{ end }}
</span>
{{ end }}
{{ partial "footer.html" . }}
</article>
{{ end }}

View file

@ -1,10 +1,6 @@
<section>
<h1 class="content-title">
{{- if .IsNode -}}
{{- .Title -}}
{{- else -}}
{{- .Title -}}{{- if .Draft -}} :: Draft {{- end -}}
{{- end -}}
{{- .Title -}}{{- if .Draft -}} :: Draft {{- end -}}
</h1>
{{- if .IsPage -}}
@ -12,7 +8,7 @@
<p class=subtitle>{{ .Params.subtitle }}</p>
{{- end -}}
{{- if or (eq .Type "post") (.Params.meta) -}}
{{- if .Params.meta -}}
<span class="content-meta">
{{- if .Params.author -}}
<p class="author">{{ .Params.author }}</p>

View file

@ -16,51 +16,51 @@
<ul class="page-footer-menu">
{{/* SOCIALS */}}
{{ if isset .Site.Params "twitter" }}
<li><a href="https://twitter.com/{{.Site.Params.twitter}}"><i class='fab fa-twitter fa-lg'></i></a></li>
<li><a href="https://twitter.com/{{.Site.Params.twitter}}">Twitter</a></li>
{{ end }}
{{ if isset .Site.Params "github" }}
<li><a href="https://github.com/{{.Site.Params.github}}"><i class='fab fa-github fa-lg'></i></a></li>
<li><a href="https://github.com/{{.Site.Params.github}}">GitHub</a></li>
{{ end }}
{{ if isset .Site.Params "gitlab" }}
<li><a href="https://gitlab.com/{{.Site.Params.gitlab}}"><i class='fab fa-gitlab fa-lg'></i></a></li>
<li><a href="https://gitlab.com/{{.Site.Params.gitlab}}">GitLab</a></li>
{{ end }}
{{ if isset .Site.Params "patreon" }}
<li><a href="https://www.patreon.com/{{.Site.Params.patreon}}"><i class='fab fa-patreon la-lg'></i></a></li>
<li><a href="https://www.patreon.com/{{.Site.Params.patreon}}">Patreon</i></a></li>
{{ end }}
{{ if isset .Site.Params "youtube" }}
<li><a href="https://www.youtube.com/{{.Site.Params.youtube}}"><i class='fab fa-youtube la-lg'></i></a></li>
<li><a href="https://www.youtube.com/{{.Site.Params.youtube}}">YouTube</a></li>
{{ end }}
{{ if isset .Site.Params "medium" }}
<li><a href="https://medium.com/{{.Site.Params.medium}}"><i class='fab fa-medium la-lg'></i></a></li>
<li><a href="https://medium.com/{{.Site.Params.medium}}">Medium</a></li>
{{ end }}
{{ if isset .Site.Params "reddit" }}
<li><a href="https://www.reddit.com/user/{{.Site.Params.reddit}}"><i class='fab fa-reddit la-lg'></i></a></li>
<li><a href="https://www.reddit.com/user/{{.Site.Params.reddit}}">Reddit</a></li>
{{ end }}
{{ if isset .Site.Params "stackoverflow" }}
<li><a href="https://stackoverflow.com/users/{{.Site.Params.stackoverflow}}?tab=profile"><i class='fab fa-stack-overflow la-lg'></i></a></li>
<li><a href="https://stackoverflow.com/users/{{.Site.Params.stackoverflow}}?tab=profile">StackOverflow</a></li>
{{ end }}
{{ if isset .Site.Params "instagram" }}
<li><a href="https://www.instagram.com/{{.Site.Params.instagram}}"><i class='fab fa-instagram la-lg'></i></a></li>
<li><a href="https://www.instagram.com/{{.Site.Params.instagram}}">Instagram</a></li>
{{ end }}
{{ if isset .Site.Params "mastodon" }}
<li><a href="https://{{.Site.Params.mastodon}}"><i class='fab fa-mastodon la-lg'></i></a></li>
<li><a href="https://{{.Site.Params.mastodon}}">Mastodon</a></li>
{{ end }}
{{ if isset .Site.Params "orcid" }}
<li><a href="https://orcid.org/{{.Site.Params.orcid}}"><i class='fab fa-orcid la-lg'></i></a></li>
<li><a href="https://orcid.org/{{.Site.Params.orcid}}">ORCID</a></li>
{{ end }}
{{ if isset .Site.Params "google_scholar" }}
<li><a href="https://scholar.google.com/citations?user={{.Site.Params.google_scholar}}"><i class='fas fa-graduation-cap la-lg'></i></a></li>
<li><a href="https://scholar.google.com/citations?user={{.Site.Params.google_scholar}}">Google Scholar</a></li>
{{ end }}
{{/* END SOCIALS */}}
{{ range .Site.Menus.footer }}