Remove trim blank charsets flag to improve speed.

This commit is contained in:
凡梦星尘
2023-01-01 21:12:58 +08:00
parent d0a6d943e0
commit a2f37c8470
55 changed files with 494 additions and 496 deletions

View File

@@ -1,7 +1,7 @@
{{- $extURL := and .Page.Site.Params.exturl.enable (strings.HasPrefix .Destination "http") }}
{{ $extURL := and .Page.Site.Params.exturl.enable (strings.HasPrefix .Destination "http") }}
<a href="{{ .Destination | safeURL }}" title="{{ .Text }}" {{ if $extURL }}rel="noopener external nofollow noreferrer" target="_blank" class=" exturl"{{ end }}>
{{ .Text | safeHTML }}
{{- if and $extURL .Page.Site.Params.exturl.icon }}
{{ if and $extURL .Page.Site.Params.exturl.icon }}
<i class="fa fa-external-link-alt"></i>
{{- end }}
{{ end }}
</a>

View File

@@ -1,13 +1,13 @@
{{- range $k, $v := (partialCached "init.html" .) -}}
{{- $.Scratch.Set $k $v -}}
{{- end -}}
{{ range $k, $v := (partialCached "init.html" .) }}
{{ $.Scratch.Set $k $v }}
{{ end }}
{{ $isComment := .Params.comment.enable | default .Site.Params.comments.enable }}
{{ .Scratch.Set "isComment" $isComment }}
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}" data-theme="{{ .Scratch.Get "theme" }}">
<head>
{{- partial "head.html" . }}
{{ partial "head.html" . }}
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
<noscript>
<link rel="stylesheet" href="/css/noscript.css">
@@ -19,30 +19,30 @@
<main class="main">
<header class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner">
{{- partial "header.html" . }}
{{ partial "header.html" . }}
</div>
<!-- Sidebar -->
{{- if ne .Site.Params.sidebar.display "remove" }}
{{- partial "sidebar.html" . }}
{{- end }}
{{ if ne .Site.Params.sidebar.display "remove" }}
{{ partial "sidebar.html" . }}
{{ end }}
</header>
<!-- Widgets -->
{{ partial "widgets.html" . }}
<div class="main-inner {{ block "main_inner_class" . }}{{ end }}">
<!-- Submenu,Content,Comment -->
{{- block "main" . }}{{- end }}
{{- if and .IsPage $isComment }}
{{- partialCached "comments.html" . }}
{{- end }}
{{ block "main" . }}{{ end }}
{{ if and .IsPage $isComment }}
{{ partialCached "comments.html" . }}
{{ end }}
</div>
</main>
<footer class="footer">
<div class="footer-inner">
{{- partialCached "footer.html" . }}
{{ partialCached "footer.html" . }}
</div>
</footer>
{{- partial "scripts.html" . }}
{{ partial "scripts.html" . }}
</body>
</html>

View File

@@ -1,6 +1,6 @@
[
{{- range $index, $entry := where .Site.RegularPages "Kind" "page" }}
{{- if $index }}, {{ end }}
{{ range $index, $entry := where .Site.RegularPages "Kind" "page" }}
{{ if $index }}, {{ end }}
{
"objectID": "{{ .Date.Unix }}",
"permalink": "{{ .Permalink | relURL }}",
@@ -9,5 +9,5 @@
"date": {{ .Date.Format $.Site.Params.timeFormat | jsonify }},
"updated": {{ .Lastmod.Format $.Site.Params.timeFormat | jsonify }}
}
{{- end }}
{{ end }}
]

View File

@@ -5,12 +5,12 @@
<title>{{ .Title }}</title>
<url>{{ .RelPermalink | relLangURL }}</url>
<categories>
{{- range .Params.categories }}<category>{{ . }}</category>{{- end }}
{{ range .Params.categories }}<category>{{ . }}</category>{{ end }}
</categories>
<tags>
{{- range .Params.tags }}
{{ range .Params.tags }}
<tag>{{ . }}</tag>
{{- end }}
{{ end }}
</tags>
<content type="html"><![CDATA[{{ .Content | plainify }}]]></content>
</entry>

View File

@@ -1,15 +1,15 @@
{{- define "title" }}
{{- .Params.Title | default (T .Section) | default .Section }} - {{ .Site.Title -}}
{{- end -}}
{{ define "title" }}
{{ .Params.Title | default (T .Section) | default .Section }} - {{ .Site.Title }}
{{ end }}
{{ define "main_inner_class" }}index posts-expand{{ end }}
{{- define "main" }}
{{ define "main" }}
{{ $paginator := .Paginate (where .Site.RegularPages "Section" "==" .Section) }}
{{- range $paginator.Pages }}
{{ range $paginator.Pages }}
{{ partial "post.html" (dict "ctx" . "IsHome" true) }}
{{- end }}
{{ end }}
{{- partial "partials/pagination.html" . }}
{{ partial "partials/pagination.html" . }}
{{- end }}
{{ end }}

View File

@@ -1,7 +1,7 @@
{{- define "title" }}{{- .Title }} - {{ .Site.Title -}}{{- end }}
{{ define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end }}
{{- define "main_inner_class" }}post posts-expand{{- end }}
{{ define "main_inner_class" }}post posts-expand{{ end }}
{{- define "main" }}
{{ define "main" }}
{{ partial "post.html" (dict "ctx" . "IsHome" false) }}
{{- end }}
{{ end }}

View File

@@ -1,6 +1,6 @@
{{- define "title" -}}
{{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title -}}
{{- end -}}
{{ define "title" }}
{{ .Title }} - {{ T .Data.Singular | default .Data.Singular }} - {{ .Site.Title }}
{{ end }}
{{ define "main_inner_class" }}{{ .Data.Plural }} posts-collapse{{ end }}
{{ define "main" }}
<div class="post-block">
@@ -18,5 +18,5 @@
</div>
</div>
{{- partial "pagination.html" . }}
{{- end }}
{{ partial "pagination.html" . }}
{{ end }}

View File

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