🎨 Finish all baseof display coding.

This commit is contained in:
凡梦星尘
2022-06-09 09:12:22 +08:00
parent 2973eaf85d
commit 3bc7506f36
20 changed files with 262 additions and 94 deletions

View File

@@ -1,3 +1,6 @@
{{- .Scratch.Set "postsCount" (len (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections)) -}}
{{- .Scratch.Set "catsCount" (len .Site.Taxonomies.categories) -}}
{{- .Scratch.Set "tagsCount" (len .Site.Taxonomies.tags) -}}
{{- $vendors := .Site.Data.resources.vendors -}}
{{- $pluginVen := .Site.Params.vendors.plugins -}}
{{- $pluginCDN := index $vendors $pluginVen -}}

View File

@@ -7,7 +7,7 @@
<div class="post-content">
<div class="collection-title">
{{- $cheers := "Um" }}
{{- $posts := .Scratch.Get "posts" }}
{{- $posts := .Scratch.Get "postsCount" }}
{{- if gt $posts 210 }}
{{- $cheers = "Excellent" }}
{{- else if gt $posts 130 }}
@@ -21,9 +21,9 @@
{{- end }}
<span class="collection-header">
{{- T (printf "PostArchiveCheers%s" $cheers) }}
{{- T "SymbolComma"}}
{{- T "ArchiveCounterTitle" $posts }}
{{- T "SymbolComma"}}
{{- T "SymbolComma" }}
{{- T "ArchiveCounterTitle" $posts | safeHTML }}
{{- T "SymbolComma" }}
{{- T "PostArchiveKeepOn" }}
</span>
</div>

View File

@@ -1,6 +1,22 @@
{{- define "title" -}}
{{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}}
{{- end -}}
{{ define "main_inner_class" }}{{ .Data.Plural }} posts-collapse{{ end }}
{{ define "main" }}
{{ .Data.Singular }}
<div class="post-block">
<div class="post-content">
<div class="collection-title">
<span class="collection-header">
<h2>
{{ .Title }}
<small>{{ T .Data.Singular | default .Data.Singular }}</small>
</h2>
</span>
</div>
{{ .Render "list" }}
</div>
</div>
{{- partial "pagination.html" . }}
{{- end }}

View File

@@ -1,6 +1,44 @@
{{- define "title" -}}
{{- .Params.Title | default (T .Data.Plural) | default .Data.Plural | dict "Some" | T "AllSome" }} - {{ .Site.Title -}}
{{- .Params.Title | default (T .Data.Plural) | default .Data.Plural | dict "Some" | T "AllSome" }} - {{ .Site.Title -}}
{{- end -}}
{{ define "main" }}
{{ .Data.Terms }}
{{ end }}
{{- define "main_inner_class" }}{{.Data.Plural}} posts-expand{{ end -}}
{{- define "main" }}
<div class="post-block" lang="{{ .Site.LanguageCode }}">
<dive class="post-body">
{{- if eq .Data.Plural "categories" }}
{{ $cats := .Site.Taxonomies.categories }}
<div class="category-all-page">
<div class="category-all-title">
{{- T "CatesCounterTitle" (.Scratch.Get "catsCount") | safeHTML -}}
</div>
<div class="category-all">
<ul class="category-list">
{{- range $name, $items := $cats }}
<li class="category-list-item">
<a class="category-list-link" href="{{ "/categories/" | relLangURL }}{{ $name | urlize | lower }}" data-pjax-state="">{{ $name }}</a>
<span class="category-list-count">{{ len $items }}</span>
</li>
{{- end }}
</ul>
</div>
</div>
{{- end }}
{{- if eq .Data.Plural "tags" }}
{{ $tags := .Site.Taxonomies.tags }}
<div class="tag-cloud">
<div class="tag-cloud-title">
{{- T "TagsCounterTitle" (.Scratch.Get "tagsCount") | safeHTML -}}
</div>
<div class="tag-cloud-tags">
{{ $randNums := (seq 10) }}
{{- range $name, $items := $tags }}
<a class="tag-cloud-{{ index (shuffle $randNums) 0 }}" href="{{ "/tags/" | relLangURL }}{{ $name | urlize | lower }}">{{ $name }}
<span class="tag-list-count"><sup>({{ len $items }})</sup></span>
</a>
{{- end }}
</div>
</div>
{{- end }}
</div>
</div>
{{- end }}