revises post navigation and post meta templates

This commit is contained in:
Huy Tran 2018-07-30 07:23:00 +10:00
parent baac6b57d9
commit f34f7ad13c
2 changed files with 16 additions and 13 deletions

View file

@ -1,21 +1,21 @@
{{ if ne .Params.showpagemeta false }} {{ if ne .Params.showpagemeta false }}
<div class="post__meta"> <div class="post__meta">
<!-- published date --> <!-- published date -->
{{ if not .Date.IsZero -}} {{ if not .Date.IsZero }}
<i class="fas fa-calendar-alt"></i> {{ .Date.Format (.Site.Params.dateformat | default "Jan 02, 2006") -}} <i class="fas fa-calendar-alt"></i> {{ .Date.Format (.Site.Params.dateformat | default "Jan 02, 2006") }}
{{- end }} {{ end }}
<!-- categories --> <!-- categories -->
{{- with .Params.categories -}} {{ with .Params.categories }}
{{- $total := len . -}} {{ $total := len . }}
{{ if gt $total 0 -}} {{ if gt $total 0 }}
in in
{{- $total := sub $total 1 -}} {{ $total := sub $total 1 }}
{{- range $i, $cat := sort . }} {{ range $i, $cat := sort . }}
<a class="post__category" href="{{ "/categories/" | relURL }}{{ $cat | urlize }}">{{ $cat | upper }}</a> <a class="post__category" href="{{ "/categories/" | relURL }}{{ $cat | urlize }}">{{ $cat | upper }}</a>
{{ if lt $i $total }}•{{ end }} {{ if lt $i $total }}•{{ end }}
{{- end -}} {{ end }}
{{- end -}} {{ end }}
{{- end -}} {{ end }}
<!-- tags --> <!-- tags -->
{{ with .Params.tags }} {{ with .Params.tags }}
{{ $total := len . }} {{ $total := len . }}

View file

@ -1,14 +1,17 @@
{{ $enabledPostNavigation := .Site.Params.postNavigation | default true }}
{{ if $enabledPostNavigation }}
<div class="post--navigation post--navigation-single"> <div class="post--navigation post--navigation-single">
{{ with .PrevInSection -}} {{ with .PrevInSection -}}
<a href="{{ .RelPermalink }}" class="post--navigation-prev"> <a href="{{ .RelPermalink }}" class="post--navigation-prev">
<i aria-hidden="true" class="fa fa-chevron-left"></i> <i aria-hidden="true" class="fa fa-chevron-left"></i>
<span>{{ .Title }}</span> <span class="navigation-tittle">{{ .Title }}</span>
</a> </a>
{{- end }} {{- end }}
{{ with .NextInSection -}} {{ with .NextInSection -}}
<a href="{{ .RelPermalink }}" class="post--navigation-next"> <a href="{{ .RelPermalink }}" class="post--navigation-next">
<span>{{ .Title }}</span> <span class="navigation-tittle">{{ .Title }}</span>
<i aria-hidden="true" class="fa fa-chevron-right"></i> <i aria-hidden="true" class="fa fa-chevron-right"></i>
</a> </a>
{{- end }} {{- end }}
</div> </div>
{{ end }}