summaryrefslogtreecommitdiff
path: root/layouts/_partials/posts/action-menu.html
diff options
context:
space:
mode:
authoreltrac <hi@eltr.ac>2026-03-30 16:52:56 +0800
committereltrac <hi@eltr.ac>2026-03-30 16:52:56 +0800
commit310a425acb95f1bc222820f72576a7c4e0885d16 (patch)
tree2a502337f675b2150996cdedd898a01da3852401 /layouts/_partials/posts/action-menu.html
parent244aec878d52ca6c52dc7d08aaf20be8c9132551 (diff)
refactor: rename action-menu -> webmention
The name "action menu" was made because it used to be where people hit like button, comment and send webmentions. Now it's only for webmentions.
Diffstat (limited to 'layouts/_partials/posts/action-menu.html')
-rw-r--r--layouts/_partials/posts/action-menu.html73
1 files changed, 0 insertions, 73 deletions
diff --git a/layouts/_partials/posts/action-menu.html b/layouts/_partials/posts/action-menu.html
deleted file mode 100644
index 51dfcc2d..00000000
--- a/layouts/_partials/posts/action-menu.html
+++ /dev/null
@@ -1,73 +0,0 @@
-{{ $page := . }}
-{{ $currentPagePath := .RelPermalink }}
-{{ $webmentions_url := .Site.Params.webmention.src }}
-
-{{ $cacheKey := print $webmentions_url (now.Format "2006-01-02-1504") }}
-{{ $opts := dict "key" $cacheKey }}
-
-{{ with try (resources.GetRemote $webmentions_url $opts) }}
- {{ with .Err }}
- {{ errorf "%s" . }}
-
- {{ else with .Value }}
- {{ $webmentions := slice }}
- {{ $data := . | transform.Unmarshal }}
-
- {{ range $data }}
- {{ $urlObj := urls.Parse .webmention.target }}
- {{ $targetPath := $urlObj.Path }}
-
- {{ if or (strings.Contains $targetPath $currentPagePath)
- (strings.Contains $targetPath ($currentPagePath | urlquery)) }}
- {{ $webmentions = $webmentions | append . }}
- {{ end }}
- {{ end }}
-
- {{ $likes := slice }}
- {{ $replies := slice }}
- {{ $reposts := slice }}
- {{ $mentions := slice }}
-
- {{ range $webmentions }}
- {{ $props := index . "microformats" "properties" }}
- {{ $type := index . "microformats" "type" 0 }}
-
- {{ if eq $type "h-entry" }}
- {{ if index $props "like-of" }}
- {{ $likes = $likes | append . }}
-
-
- {{ else if index $props "repost-of" }}
- {{ $reposts = $mentions | append . }}
-
- {{ else }}
- {{ $replies = $replies | append . }}
-
- {{ end }}
- {{ else }}
- {{ $mentions = $mentions | append . }}
- {{ end }}
-
- {{ end }}
-
- {{ partial "posts/action-area" $page }}
- <details class="my-4 mb-5 no-mark">
- <summary class="cursor-pointer flex">
- {{ partial "posts/webmention-summary" (dict
- "likes" $likes
- "page" $page
- "othercount" (add (len $replies) (len $mentions))
- ) }}
- </summary>
- <div id="webmention-details">
- {{ partial "posts/webmention-replies" $replies }}
- {{ partial "posts/webmention-mentions" $mentions }}
- </div>
-
- <!-- kept for legacy pages -->
- {{ partial "posts/comment" $page }}
- </details>
- {{ else }}
- <p>Unable to fetch webmentions. Please contact webmaster.</p>
- {{ end }}
-{{ end }}