blob: a1bd3ccd65b5d4b3c2ca4acf7a8c48120d717c63 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
{{ $currentHeading := .Title | emojify }}
{{ $mainTitle := .Params.mainTitle | emojify }}
{{ $titleSeparator := .Site.Params.titleSeparator }}
<!-- If 404 page -->
{{ if (eq .Kind "404") }}
{{ $currentHeading = (.Site.Params.notFound.title | default .Site.Data.default.notFound.title) | emojify }}
<!-- If post list -->
{{ else if (eq .Kind "section") }}
{{ if gt .Paginator.TotalPages 1 }}
{{ $mainTitle = printf `%v, %v %v %v %v` .Title (T "page") .Paginator.PageNumber (T "of") .Paginator.TotalPages }}
{{ end }}
<!-- If tags/categories list -->
{{ else if eq .Kind "term" }}
{{ $currentTerm := false }}
{{ if eq .Type "tags" }}
{{ $currentTerm = (T "tag") }}
{{ else }}
{{ $currentTerm = (T "category") }}
{{ end }}
{{ $currentHeading = printf `%v: "%v"` $currentTerm .Title }}
{{ with .Paginator }}
{{ if gt .TotalPages 1 }}
{{ $mainTitle = printf `%v: "%v", %v %v %v %v` $currentTerm $.Title (T "page") .PageNumber (T "of") .TotalPages }}
{{ else }}
{{ $mainTitle = printf `%v: "%v"` $currentTerm $.Title }}
{{ end }}
{{ end }}
<!-- If tags/categories page -->
{{ else if eq .Kind "taxonomy" }}
{{ if eq .Type "tags" }}
{{ $currentHeading = (T "tags") }}
{{ else }}
{{ $currentHeading = (T "categories") }}
{{ end }}
<!-- If home page without content -->
{{ else if and (.IsHome) (not .Content) }}
{{ $currentHeading = .Site.Title | emojify }}
{{ end }}
{{ $currentDesc := .Params.Description | emojify }}
{{ if .IsHome }}
{{ $currentDesc = .Site.Params.description | emojify }}
{{ else if and (ne .Kind "taxonomy") (eq .Type "tags") (not .Params.description) }}
{{ $currentDesc = (T "postsUnderTag" .) }}
{{ else if and (ne .Kind "taxonomy") (eq .Type "categories") (not .Params.description) }}
{{ $currentDesc = (T "postsUnderCategory" .) }}
{{ else if eq .Kind "taxonomy" }}
{{ $currentDesc = printf `%v %v.` (T "pageContaining") $currentHeading }}
{{ else if (eq .Kind "404") }}
{{ $currentDesc = (.Site.Params.notFound.description | default .Site.Data.default.notFound.description) | emojify }}
{{ end }}
{{ $currentTitle := $currentHeading }}
{{ if and $titleSeparator (not .Params.disableTitleSeparator) }}
{{ if $mainTitle }}
{{ $currentTitle = printf `%v %v %v` $mainTitle $titleSeparator .Site.Title }}
{{ else }}
{{ $currentTitle = printf `%v %v %v` $currentHeading $titleSeparator .Site.Title }}
{{ end }}
{{ end }}
{{ return (dict "heading" $currentHeading "description" $currentDesc "title" $currentTitle) }}
|