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" }} {{ define "main" }}
<article id="main" class="home-page"> <article id="main" class="home-page">
{{ partial "brand.html" . }} {{ partial "brand.html" . }}
{{ with .Content }} {{ with .Content }}
<section> <section>
{{ . }} {{ . }}
</section> </section>
{{ end }} {{ end }}
<section class="page-list"> <section class="page-list">
{{ range .Site.RegularPages }} {{ range (.Paginate .Site.RegularPages).Pages }}
{{/* range where .Site.RegularPages "Type" "posts" */}} {{/* range where .Site.RegularPages "Type" "posts" */}}
{{ if ne .Draft true}} {{ if ne .Draft true}}
<h2 class="content-title"> <h2 class="content-title">
{{ if .IsNode }} {{ if .IsNode }}
<a href="{{ .Permalink }}">{{ .Title}}</a> <a href="{{ .Permalink }}">{{ .Title}}</a>
{{ else }} {{ else }}
<a href="{{ .RelPermalink }}">{{ .Title }}{{ if .Draft }} :: Draft {{end}}</a> <a href="{{ .RelPermalink }}">{{ .Title }}{{ if .Draft }} :: Draft {{end}}</a>
{{ end }} {{ end }}
</h1> </h2>
{{ if .Description }}
<p>{{ .Description }}</p>
{{ else }}
<p>{{ truncate 140 .Summary }}</p> <p>{{ truncate 140 .Summary }}</p>
{{ end }} {{ end }}
{{ end }}
</section> {{ end }}
{{ partial "footer.html" . }} {{ 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> </article>
{{ end }} {{ end }}

View file

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

View file

@ -16,51 +16,51 @@
<ul class="page-footer-menu"> <ul class="page-footer-menu">
{{/* SOCIALS */}} {{/* SOCIALS */}}
{{ if isset .Site.Params "twitter" }} {{ 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 }} {{ end }}
{{ if isset .Site.Params "github" }} {{ 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 }} {{ end }}
{{ if isset .Site.Params "gitlab" }} {{ 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 }} {{ end }}
{{ if isset .Site.Params "patreon" }} {{ 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 }} {{ end }}
{{ if isset .Site.Params "youtube" }} {{ 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 }} {{ end }}
{{ if isset .Site.Params "medium" }} {{ 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 }} {{ end }}
{{ if isset .Site.Params "reddit" }} {{ 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 }} {{ end }}
{{ if isset .Site.Params "stackoverflow" }} {{ 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 }} {{ end }}
{{ if isset .Site.Params "instagram" }} {{ 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 }} {{ end }}
{{ if isset .Site.Params "mastodon" }} {{ 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 }} {{ end }}
{{ if isset .Site.Params "orcid" }} {{ 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 }} {{ end }}
{{ if isset .Site.Params "google_scholar" }} {{ 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 }}
{{/* END SOCIALS */}} {{/* END SOCIALS */}}
{{ range .Site.Menus.footer }} {{ range .Site.Menus.footer }}