feat: faster, support custom lib cdn and more standardized code style

This commit is contained in:
Dillon
2019-08-23 02:01:22 +08:00
parent f1ec275c9f
commit 934c3a5156
60 changed files with 10458 additions and 170 deletions

View File

@@ -1,16 +1,16 @@
{{ define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end }}
{{ define "title" }}{{ .Title }} | {{ T .Data.Singular | default (humanize .Data.Singular) }} | {{ .Site.Title }}{{ end }}
{{ define "content" }}
{{ $taxonomy := .Data.Singular }}
{{ $taxonomyName := $taxonomy }}
{{ if eq $taxonomy "tag"}}
{{ $taxonomyName = (T "tag") }}
{{ else if eq $taxonomy "category"}}
{{ $taxonomyName = (T "category") }}
{{ end }}
<div class="post-warp archive">
<h2 class="post-title">
{{- printf "%s - %s" $taxonomyName .Title -}}
{{ $taxonomy := .Data.Singular }}
{{ if eq $taxonomy "category" }}
<i class="far fa-folder-open"></i>&nbsp;{{ .Title }}
{{ else if eq $taxonomy "tag" }}
<i class="fas fa-tag"></i>&nbsp;{{ .Title }}
{{ else }}
{{ printf "%s - %s" (T $taxonomy | default (humanize $taxonomy)) .Title }}
{{ end }}
</h2>
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
<h3>{{ .Key }}</h3>

View File

@@ -1,25 +1,17 @@
{{ define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end }}
{{ define "title" }}{{ T .Data.Plural | default (humanize .Data.Plural) }} | {{ .Site.Title }}{{ end }}
{{ define "content" }}
{{ $taxonomy := .Data.Singular }}
{{ $taxonomysName := $taxonomy }}
{{ if eq $taxonomy "tag"}}
{{ $taxonomysName = (T "tags") }}
{{ else if eq $taxonomy "category"}}
{{ $taxonomysName = (T "categories") }}
{{ end }}
{{ $taxonomies := .Data.Plural }}
{{ $terms := .Data.Terms.ByCount }}
{{ $length := len $terms }}
{{ $type := .Type }}
<div class="post-warp archive">
<h2 class="post-title">
{{- printf "- %s -" $taxonomysName -}}
{{- printf "%s%s" (T "all") (T $taxonomies | default (humanize $taxonomies)) -}}
</h2>
<!-- Categories Page -->
{{ if eq $taxonomy "category" }}
{{ if eq $taxonomies "categories" }}
<div class="categories-card">
{{ range $terms }}
{{ $term := .Term }}
@@ -47,7 +39,7 @@
</div>
<!-- Tag Cloud Page -->
{{ else if eq $taxonomy "tag" }}
{{ else if eq $taxonomies "tags" }}
<div class="tag-cloud-tags">
{{ range $.Site.Taxonomies.tags.ByCount }}
<a href="{{ .Page.Permalink }}"> {{ .Page.Title }} <small>({{ .Count }})</small></a>