forked from rhazdon/hugo-theme-hello-friend-ng
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webmentions.html
122 lines (109 loc) · 4 KB
/
webmentions.html
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
{{ $thisURL := ""}}
{{ if $.Site.Params.webmentionTestUrl }}
<!-- If During Development -->
{{ $thisURL = printf "https://markgroves.us%s" $.RelPermalink }}
{{ else }}
{{ $thisURL = $.Permalink }}
{{ end }}
{{ $thisReplies := dict }}
{{ range $k, $v := .Site.Data.webmentions }}
{{ with . }}
{{ if eq .target $thisURL}}
{{ $dValue := dict $k $v }}
{{ $thisReplies = merge $thisReplies $dValue }}
{{ else }}
{{end }}
{{ end }}
{{ end }}
{{ $thisLikes := dict }}
{{ $thisInReplyTo := dict }}
{{ $thisMentionOf := dict }}
{{ range $k, $v := $thisReplies }}
{{ with . }}
{{ if isset .post "wm-property" }}
{{ if eq (index .post "wm-property") "like-of"}}
{{ $dValue := dict $k $v }}
{{ $thisLikes = merge $thisLikes $dValue }}
{{ else if eq (index .post "wm-property") "in-reply-to"}}
{{ $dValue := dict $k $v }}
{{ $thisInReplyTo = merge $thisInReplyTo $dValue }}
{{ else if eq (index .post "wm-property") "mention-of"}}
{{ $dValue := dict $k $v }}
{{ $thisMentionOf = merge $thisMentionOf $dValue }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ with $thisLikes }}
<div class="webmentions">
<div class="pagination">
<div class="pagination__title">
<span class="pagination__title-h">Likes</span>
<hr/>
</div>
</div>
<div class="likes">
{{ range $thisLikes }}
{{ with .post }}
<div class="u-comment h-cite">
<div class="card">
<a class="u-author h-card" {{- if .url -}} href="{{ .url }}" {{ end }}>
<span class="name" >{{ .author.name | humanize }}</span>
</a>
<a class="h-card" {{ if .author.url }} href="{{ .author.url }}" {{ end }}><img src="{{ if .author.photo }}{{ .author.photo }}{{else}}/default-person.png{{end}}"/></a>
</div>
</div>
{{ end }}
{{ end }}
</div>
</div>
{{ end }}
{{ with $thisInReplyTo }}
<div class="pagination__title">
<span class="pagination__title-h">Replies</span>
<hr/>
</div>
{{ range $thisInReplyTo }}
{{ with .post }}
<div class="u-comment h-cite">
<a class="u-author h-card" {{- if .author.url -}} href="{{ .author.url }}" {{ end }}>
{{ .author.name | humanize }}
</a>
</p>
<p class="e-content e-name">
{{- .content.html | safeHTML }}
</p>
<a class="u-url" href="{{ .url }}">
{{ .url }}
</a>
@
<time class="dt-published">{{ if .published }}{{ dateFormat $.Site.Params.dateformNumTime .published }}{{ end }}</time>
</div>
<hr/>
{{ end }}
{{ end }}
{{ end }}
{{ with $thisMentionOf }}
<div class="pagination__title">
<span class="pagination__title-h">Mentions</span>
<hr/>
</div>
{{ range $thisMentionOf }}
{{ with .post }}
<div class="u-comment h-cite">
<a class="u-author h-card" {{- if .author.url -}} href="{{ .author.url }}" {{ end }}>
{{ .author.name | humanize }}
</a>
</p>
<p class="e-content e-name">
{{- .content.html | safeHTML }}
</p>
<a class="u-url" href="{{ .url }}">
{{ .url }}
</a>
@
<time class="dt-published">{{ if .published }}{{ dateFormat $.Site.Params.dateformNumTime .published }}{{ end }}</time>
</div>
{{ end }}
{{ end }}
{{ end }}