diff options
| author | BigCoke233 <hi@guhub.cn> | 2026-01-08 11:32:08 +0800 |
|---|---|---|
| committer | BigCoke233 <hi@guhub.cn> | 2026-01-08 11:32:08 +0800 |
| commit | bb5c91845361ea0445fdfeaebd9d69e5809a3ab3 (patch) | |
| tree | 49ae788ff051e6e4c2036e55c76847babd8eb07a /layouts | |
| parent | 6f167e180272b00255e9ac69e00a24c607d0ce4f (diff) | |
fix: fedi link not shown when no webmention is found
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/_partials/posts/action-menu/webmention-section.html | 134 |
1 files changed, 66 insertions, 68 deletions
diff --git a/layouts/_partials/posts/action-menu/webmention-section.html b/layouts/_partials/posts/action-menu/webmention-section.html index 81e90e3c..b304feae 100644 --- a/layouts/_partials/posts/action-menu/webmention-section.html +++ b/layouts/_partials/posts/action-menu/webmention-section.html @@ -3,11 +3,10 @@ <div class="mt-4 hidden animate-duration-200" id="webmention-section"> <div> {{ $webmentions := index .Site.Data.webmentions .RelPermalink }} + {{ $webmentionLikes := slice }} + {{ $webmentionReplies := slice }} + {{ $webmentionMentions := slice }} {{ with $webmentions }} - - {{ $webmentionLikes := slice }} - {{ $webmentionReplies := slice }} - {{ $webmentionMentions := slice }} {{ range . }} {{ if eq .type "like-of" }} {{ $webmentionLikes = $webmentionLikes | append . }} @@ -17,80 +16,79 @@ {{ $webmentionMentions = $webmentionMentions | append . }} {{ end }} {{ end }} + {{ end }} - <!-- likes --> - {{ with $webmentionLikes }} - <section class="mb-6 flex gap-2 items-center"> - <div class="flex gap-1 group"> - {{ range . }} - <a href="{{ .author.url }}" target="_blank" title="{{ .author.name }}"> - {{ $value := math.Floor (mul math.Rand 80) }} - {{ $rotate := cond (lt $value 40) (sub 10 $value) (sub $value 30) }} - <img src="{{ .author.photo }}" alt="Profile Picture" - class="h-5 w-5 rd-full transition-transform {{ if lt $rotate 0 }}group-hover:-rotate-{{ mul -1 $rotate }}{{ else }}group-hover:rotate-{{ $rotate }}{{ end }} hover:scale-150" /> - </a> - {{ end }} - </div> - <p class="text-secondary m-0 text-sm">{{ printf (T "webmention.likedBy") (len $webmentionLikes) }}</p> - </section> + <!-- likes --> + {{ with $webmentionLikes }} + <section class="mb-6 flex gap-2 items-center"> + <div class="flex gap-1 group"> + {{ range . }} + <a href="{{ .author.url }}" target="_blank" title="{{ .author.name }}"> + {{ $value := math.Floor (mul math.Rand 80) }} + {{ $rotate := cond (lt $value 40) (sub 10 $value) (sub $value 30) }} + <img src="{{ .author.photo }}" alt="Profile Picture" + class="h-5 w-5 rd-full transition-transform {{ if lt $rotate 0 }}group-hover:-rotate-{{ mul -1 $rotate }}{{ else }}group-hover:rotate-{{ $rotate }}{{ end }} hover:scale-150" /> + </a> {{ end }} + </div> + <p class="text-secondary m-0 text-sm">{{ printf (T "webmention.likedBy") (len $webmentionLikes) }}</p> + </section> + {{ end }} - <!-- replies --> - {{ with $webmentionReplies }} - <section> - {{ range . }} - <div> - <div class="flex items-center gap-3"> - <img src="{{ .author.photo }}" alt="Profile Picture" - class="h-8 w-8 rd-full" loading="lazy" /> - <div class="text-secondary"> - <h4 class="m-0"> - <a href="{{ or .url .author.url }}"> - {{ .author.name }} - </a> - </h4> - {{ $t := time.AsTime .received }} - <p class="m-0"><time>{{ time.Format "2006-1-2" $t}}</time></p> - </div> + <!-- replies --> + {{ with $webmentionReplies }} + <section> + {{ range . }} + <div> + <div class="flex items-center gap-3"> + <img src="{{ .author.photo }}" alt="Profile Picture" + class="h-8 w-8 rd-full" loading="lazy" /> + <div class="text-secondary"> + <h4 class="m-0"> + <a href="{{ or .url .author.url }}"> + {{ .author.name }} + </a> + </h4> + {{ $t := time.AsTime .received }} + <p class="m-0"><time>{{ time.Format "2006-1-2" $t}}</time></p> </div> - <div class="markdown-body leading-relaxed px-2">{{ .content.html | safeHTML }}</div> </div> + <div class="markdown-body leading-relaxed px-2">{{ .content.html | safeHTML }}</div> + </div> + {{ end }} + </section> + <hr /> + {{ end }} + + <!-- Fediverse interaction link --> + <section class="text-secondary text-sm"> + {{ with $.Params.toot }} + <a href="{{ . }}" target="_blank" rel="noopener noreferrer" class="text-secondary hover:underline"> + {{ T "webmention.interactOnFediverse" }} → + </a> + {{ else }} + <a href="https://c7.io/@eltrac/tagged/%E5%8D%9A%E5%AE%A2%E6%9B%B4%E6%96%B0" target="_blank" rel="noopener noreferrer" class="text-secondary hover:underline"> + {{ T "webmention.interactOnFediverse" }} → + </a> {{ end }} - </section> + </section> - <!-- Fediverse interaction link --> - <section class="text-secondary text-sm"> - {{ with $.Params.toot }} - <a href="{{ . }}" target="_blank" rel="noopener noreferrer" class="text-secondary hover:underline"> - {{ T "webmention.interactOnFediverse" }} → - </a> + <!-- mentions --> + {{ with $webmentionMentions }} + <section class="markdown-body"> + <h3>{{ T "webmention.mentionsHeading" . }}</h3> + {{ range . }} + <ul class=""> + {{ with .content }} + <li class="markdown-body leading-relaxed">{{ .html | safeHTML }}</li> {{ else }} - <a href="https://c7.io/@eltrac/tagged/%E5%8D%9A%E5%AE%A2%E6%9B%B4%E6%96%B0" target="_blank" rel="noopener noreferrer" class="text-secondary hover:underline"> - {{ T "webmention.interactOnFediverse" }} → - </a> + <li><a href="{{ .url }}" target="_blank">{{ .url }}</a></li> {{ end }} - </section> - <hr /> - {{ end }} - - - <!-- mentions --> - {{ with $webmentionMentions }} - <section class="markdown-body"> - <h3>{{ T "webmention.mentionsHeading" . }}</h3> - {{ range . }} - <ul class=""> - {{ with .content }} - <li class="markdown-body leading-relaxed">{{ .html | safeHTML }}</li> - {{ else }} - <li><a href="{{ .url }}" target="_blank">{{ .url }}</a></li> - {{ end }} - </ul> - {{ end }} - </section> - {{ end }} - + </ul> {{ end }} + </section> + {{ end }} + </div> <div class="bg-blockBg mt-3 py-3 px-5 rd markdown-body"> |
