Perf: use .LinkTitle instead of .Title

This commit is contained in:
Cell
2023-12-08 19:50:03 +08:00
parent 307851fc25
commit c606e8c96e
11 changed files with 23 additions and 23 deletions
+1 -1
View File
@@ -40,7 +40,7 @@
<h2 class="group-title">{{ .Key }}</h2>
{{- range .Pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .LinkTitle -}}</a>
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Date.Format }}'>
{{- .Date | dateFormat ($.Site.Params.section.dateFormat | default "01-02") -}}
</span>
+1 -1
View File
@@ -61,7 +61,7 @@
{{- range $value := . -}}
{{- $tag := partialCached "function/path.html" $value $value | printf "/tags/%v" | $.Site.GetPage -}}
{{- with $tag -}}
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}' class="post-tag">{{ .Title }}</a>
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}' class="post-tag">{{ .LinkTitle }}</a>
{{- end -}}
{{- end -}}
</div>
+2 -2
View File
@@ -3,10 +3,10 @@
<ol class="breadcrumb">
{{- range .Ancestors.Reverse -}}
{{- if or .Site.Params.breadcrumb.showHome (not .IsHome) -}}
<li class="breadcrumb-item"><a href="{{ .RelPermalink }}" title="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage | and .Summary }}{{ .Summary }}{{ else }}{{ .Title }}{{ end }}{{ end }}">{{ cond (and .Site.Params.breadcrumb.showHome .IsHome) (T "single.home") .Title }}</a></li>
<li class="breadcrumb-item"><a href="{{ .RelPermalink }}" title="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage | and .Summary }}{{ .Summary }}{{ else }}{{ .LinkTitle }}{{ end }}{{ end }}">{{ cond (and .Site.Params.breadcrumb.showHome .IsHome) (T "single.home") .LinkTitle }}</a></li>
{{- end -}}
{{- end -}}
<li class="breadcrumb-item active" aria-current="page">{{ .Title }}</li>
<li class="breadcrumb-item active" aria-current="page">{{ .LinkTitle }}</li>
</ol>
</nav>
{{- end -}}
+1 -1
View File
@@ -12,7 +12,7 @@
{{- $hasTitle = true -}}
{{- end -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .LinkTitle -}}</a>
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Lastmod.Format }}'>
{{- with .Lastmod | dateFormat (.Site.Params.section.dateformat | default "01-02") -}}
{{- dict "Date" . | T "single.updatedOnDate" -}}
+4 -4
View File
@@ -8,21 +8,21 @@
$term.RelPermalink
(dict "Class" "fa-solid fa-layer-group fa-fw" | partial "plugin/icon.html")
(T "collection")
$term.Title
$term.LinkTitle
-}}
<div class="collection-card">
<div class="collection-title text-secondary">
{{ dict "Collections" $termLink | T "single.includedIn.collections" | safeHTML }} {{ len $term.Pages }}
{{ dict "Collections" $termLink | T "single.includedIn.collections" | safeHTML }} {{ $term.Pages.Len }}
</div>
<div class="collection-nav">
{{- with $term.Pages.Prev $ -}}
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="prev" title="{{ .Title }}">
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="prev" title="{{ .LinkTitle }}">
{{- dict "Class" "fa-solid fa-angle-left fa-fw" | partial "plugin/icon.html" -}}
<span>{{- .LinkTitle -}}</span>
</a>
{{- end -}}
{{- with $term.Pages.Next $ -}}
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="next" title="{{ .Title }}">
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="next" title="{{ .LinkTitle }}">
<span>{{- .LinkTitle -}}</span>
{{- dict "Class" "fa-solid fa-angle-right fa-fw" | partial "plugin/icon.html" -}}
</a>
+5 -5
View File
@@ -63,7 +63,7 @@
{{- range $value := . -}}
{{- $tag := partialCached "function/path.html" $value $value | printf "/tags/%v" | $.Site.GetPage -}}
{{- with $tag -}}
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}' class="post-tag">{{ .Title }}</a>
<a href='{{ partial "function/escapeurl.html" .RelPermalink }}' class="post-tag">{{ .LinkTitle }}</a>
{{- end -}}
{{- end -}}
{{- end -}}
@@ -75,14 +75,14 @@
<div class="post-nav">
{{- with .Prev -}}
<a href="{{ .RelPermalink }}" class="post-nav-item" rel="prev" title="{{ .Title }}">
<a href="{{ .RelPermalink }}" class="post-nav-item" rel="prev" title="{{ .LinkTitle }}">
{{- dict "Class" "fa-solid fa-angle-left fa-fw" | partial "plugin/icon.html" -}}
{{- .Title -}}
{{- .LinkTitle -}}
</a>
{{- end -}}
{{ with .Next }}
<a href="{{ .RelPermalink }}" class="post-nav-item" rel="next" title="{{ .Title }}">
{{- .Title -}}
<a href="{{ .RelPermalink }}" class="post-nav-item" rel="next" title="{{ .LinkTitle }}">
{{- .LinkTitle -}}
{{- dict "Class" "fa-solid fa-angle-right fa-fw" | partial "plugin/icon.html" -}}
</a>
{{- end -}}
@@ -4,9 +4,9 @@
{{- $categories = $categories | append (
printf `<a href="%v" class="post-category" title="%v">%v %v</a>`
(partial "function/escapeurl.html" $category.RelPermalink)
(printf "%v - %v" (T "category") $category.Title)
(printf "%v - %v" (T "category") $category.LinkTitle)
(dict "Class" "fa-regular fa-folder fa-fw" | partial "plugin/icon.html")
$category.Title
$category.LinkTitle
) -}}
{{- end -}}
{{- $categoriesStr := delimit $categories "&ensp;" -}}
@@ -17,9 +17,9 @@
{{- $collections = $collections | append (
printf `<a href="%v" class="post-collection" title="%v">%v %v</a>`
(partial "function/escapeurl.html" $collection.RelPermalink)
(printf "%v - %v" (T "collection") $collection.Title)
(printf "%v - %v" (T "collection") $collection.LinkTitle)
(dict "Class" "fa-solid fa-layer-group fa-fw" | partial "plugin/icon.html")
$collection.Title
$collection.LinkTitle
) -}}
{{- end -}}
{{- $collectionStr := delimit $collections "&ensp;" -}}
+1 -1
View File
@@ -37,7 +37,7 @@
<h3 class="group-title">{{ .Key }}</h3>
{{- range .Pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .LinkTitle -}}</a>
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Date.Format }}'>
{{- .Date | dateFormat ($.Site.Params.list.dateFormat | default "01-02") -}}
</span>
+1 -1
View File
@@ -15,7 +15,7 @@
</h3>
{{- range first 5 $pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .LinkTitle -}}</a>
</article>
{{- end -}}
{{- if gt (len $pages) 5 -}}
+1 -1
View File
@@ -15,7 +15,7 @@
</h3>
{{- range first 5 $pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .LinkTitle -}}</a>
</article>
{{- end -}}
{{- if gt (len $pages) 5 -}}
+2 -2
View File
@@ -11,11 +11,11 @@
{{- range $tags -}}
{{- $grade := math.Min (math.Floor (div (sub .Count 1) $baseGrade)) 10 -}}
{{- $fontSize := add $minFont (mul $grade $baseFont) -}}
<a href='{{ partial "function/escapeurl.html" .Page.RelPermalink }}' class="tag-cloud-{{ $grade }}" style="--tag-font: {{ $fontSize }}px">{{ .Page.Title }} <sup>{{ .Count }}</sup></a>
<a href='{{ partial "function/escapeurl.html" .Page.RelPermalink }}' class="tag-cloud-{{ $grade }}" style="--tag-font: {{ $fontSize }}px">{{ .Page.LinkTitle }} <sup>{{ .Count }}</sup></a>
{{- end -}}
{{- else -}}
{{- range $.Site.Taxonomies.tags.ByCount -}}
<a href='{{ partial "function/escapeurl.html" .Page.RelPermalink }}'>{{ .Page.Title }} <sup>{{ .Count }}</sup></a>
<a href='{{ partial "function/escapeurl.html" .Page.RelPermalink }}'>{{ .Page.LinkTitle }} <sup>{{ .Count }}</sup></a>
{{- end -}}
{{- end -}}
</div>