update post layout implementation

This commit is contained in:
geekifan
2025-04-22 13:45:20 +08:00
parent 8cd7c5bdc2
commit d24c640ab7
2 changed files with 11 additions and 6 deletions

View File

@ -16,7 +16,7 @@
<!-- layout specified -->
{{ if or (eq .Layout "post") (eq .Layout "page") $is_home }}
{{ if or (eq .Type "post") (eq .Layout "page") $is_home }}
{{ with $data.lazyPolyfill.js }}
{{ $urls = $urls | append . }}
{{ end }}
@ -32,7 +32,7 @@
{{ end }}
{{ end }}
{{ if or $is_home (eq .Layout "post") (eq .Layout "archives") (eq .Layout "category") (eq .Layout "tag") }}
{{ if or $is_home (eq .Type "post") (eq .Layout "archives") (eq .Layout "category") (eq .Layout "tag") }}
{{ $locale := strings.TrimSuffix (path.Ext .Lang) .Lang }}
{{ with $data.dayjs.js.common }}
@ -72,7 +72,7 @@
{{ $js = "home" }}
{{ else if eq .Layout "categories" }}
{{ $js = "categories" }}
{{ else if eq .Layout "post" }}
{{ else if eq .Type "post" }}
{{ $js = "post" }}
{{ else if eq .Layout "page" }}
{{ $js = "page" }}
@ -93,7 +93,7 @@
{{ end }}
<!-- Pageviews -->
{{ if eq .Layout "post" }}
{{ if eq .Type "post" }}
{{ $provider := site.Params.pageviews.provider }}
{{ if and $provider (ne $provider "") }}
{{ if eq $provider "goatcounter" }}

View File

@ -122,9 +122,9 @@
{{ with .Params.categories }}
<div class="post-meta mb-3">
<i class="far fa-folder-open fa-fw me-1"></i>
{{ $len := len . }}
{{ range $i, $category := . }}
<a href="{{ "/categories/" | relLangURL }}{{ $category | urlize }}/">{{ $category }}</a>
{{ if not (eq $i (sub (len $) 1)) }},{{ end }}
<a href="{{ "/categories/" | relLangURL }}{{ $category | urlize }}/">{{ $category }}</a>{{ if not (eq $i (sub $len 1)) }},{{ end }}
{{ end }}
</div>
{{ end }}
@ -159,4 +159,9 @@
{{ define "panel" }}
{{ partial "toc.html" . }}
{{ end }}
{{ define "tail" }}
{{ partial "related-posts.html" . }}
{{ partial "post-nav.html" . }}
{{ end }}