Skip to content

Commit

Permalink
fix: empty title when set slug in _index.md
Browse files Browse the repository at this point in the history
  • Loading branch information
reuixiy committed Aug 29, 2019
1 parent 043127a commit f25707d
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<h1 class="list-title">{{ .Title | default (delimit (last 1 (split (strings.TrimSuffix "/_index.md" .Path) "/")) " ") }}</h1>
{{ end }}
{{ if (eq .Kind "taxonomy") }}
<h1 class="list-title">{{ .Title | default .Data.Term }}</h1>
<h1 class="list-title">{{ .Title | default .Data.Term | default (delimit (last 1 (split (strings.TrimSuffix "/_index.md" .Path) "/")) " ") }}</h1>
{{ end }}
{{ end }}

Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/components/title.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{{- .Scratch.Set "title" $title -}}
<!-- Taxonomy Term -->
{{- else if eq .Kind "taxonomy" -}}
{{- $taxonomyTermTitle := .Title | default .Data.Term -}}
{{- $taxonomyTermTitle := .Title | default .Data.Term | default (delimit (last 1 (split (strings.TrimSuffix "/_index.md" .Path) "/")) " ") -}}
{{- with .Site.GetPage (printf "/%s" .Data.Plural) -}}
{{- $title := printf "%s: %s | %s" (.Title | default (.Type | title)) $taxonomyTermTitle .Site.Title -}}
{{- $.Scratch.Set "title" $title -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/tag-cloud.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h1 class="list-title">{{ .Title | default (.Type | title) }}</h1>
{{ $weigth := div (sub (math.Log $count) (math.Log $min)) (sub (math.Log $max) (math.Log $min)) }}
{{ $currentFontSize := (add $smallestFontSize (mul (sub $largestFontSize $smallestFontSize) $weigth)) }}
{{ with $.Site.GetPage (printf "/tags/%s" $name) }}
<a href="{{ .RelPermalink }}" class="tag-cloud-item" style="font-size: {{ $currentFontSize }}{{ $fontUnit }}">{{ .LinkTitle | default .Data.Term }}</a>
<a href="{{ .RelPermalink }}" class="tag-cloud-item" style="font-size: {{ $currentFontSize }}{{ $fontUnit }}">{{ .LinkTitle | default .Data.Term | default $name }}</a>
{{ end }}
{{ end }}
{{ end }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/taxonomy.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h1 class="list-title">{{ .Title | default (.Type | title) }}</h1>
<ul class="list-part">
<h2 class="term-title">
{{ with $.Site.GetPage (printf "/%s/%s" $type $name) }}
<a href="{{ .RelPermalink }}" class="term-title-link">{{ .LinkTitle | default .Data.Term }}</a>
<a href="{{ .RelPermalink }}" class="term-title-link">{{ .LinkTitle | default .Data.Term | default $name }}</a>
{{ end }}
{{ if $.Site.Params.displayTaxonomyTermCount }}
<span class="term-count">{{ printf "(%d)" .Count }}</span>
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/tree/categories.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h1 class="list-title">{{ .Title | default (.Type | title) }}</h1>
{{ $lastTerm := (delimit (last 1 $categoryTerms) " ") }}
{{ with $.Site.GetPage (printf `/categories/%s` $lastTerm) }}
<p style="padding-left: {{ $padding }}em">
<a href="{{ .RelPermalink }}" class="category-item">{{ .LinkTitle | default .Data.Term }}</a>
<a href="{{ .RelPermalink }}" class="category-item">{{ .LinkTitle | default .Data.Term | default $lastTerm }}</a>
{{ if $.Site.Params.displayPostsCount }}
<span class="category-count">{{ printf "(%d)" (len .Data.category) }}</span>
{{ end }}
Expand Down

0 comments on commit f25707d

Please sign in to comment.