diff options
Diffstat (limited to 'layouts/_partials/posts')
| -rw-r--r-- | layouts/_partials/posts/action-area.html | 16 | ||||
| -rw-r--r-- | layouts/_partials/posts/banner.html | 9 | ||||
| -rw-r--r-- | layouts/_partials/posts/comment.html | 38 | ||||
| -rw-r--r-- | layouts/_partials/posts/endnotes.html | 13 | ||||
| -rw-r--r-- | layouts/_partials/posts/fediverse-form.html | 14 | ||||
| -rw-r--r-- | layouts/_partials/posts/toc.html | 10 | ||||
| -rw-r--r-- | layouts/_partials/posts/webmention-form.html | 6 | ||||
| -rw-r--r-- | layouts/_partials/posts/webmention-mentions.html | 56 | ||||
| -rw-r--r-- | layouts/_partials/posts/webmention-replies.html | 69 | ||||
| -rw-r--r-- | layouts/_partials/posts/webmention-summary.html | 54 | ||||
| -rw-r--r-- | layouts/_partials/posts/webmention.html | 73 |
11 files changed, 0 insertions, 358 deletions
diff --git a/layouts/_partials/posts/action-area.html b/layouts/_partials/posts/action-area.html deleted file mode 100644 index 06f0003d..00000000 --- a/layouts/_partials/posts/action-area.html +++ /dev/null @@ -1,16 +0,0 @@ -<div popover - id="action-area" - class="bg-white dark:bg-neutral-800 - border border-neutral-200 dark:border-neutral-600 - rd-md shadow-lg p-4 w-80"> - <div class="grid grid-cols-2 gap-4"> - {{ partial "posts/fediverse-form" . }} - {{ partial "posts/webmention-form" . }} - </div> - <div class="flex justify-between mt-2 items-center"> - <p class="text-sm text-secondary m-0"><a href="mailto:hi@eltr.ac?subject=Re%3A%20{{ .Title }}">📧 {{ T "actionMenu.email" }}</a></p> - {{ if eq .Site.Language.Lang "zh" }} - <p class="m-0 text-xs"><a class="text-secondary" href="/posts/site-report-4/#所以怎么点赞和评论你的博客">这是什么?</a></p> - {{ end }} - </div> -</div> diff --git a/layouts/_partials/posts/banner.html b/layouts/_partials/posts/banner.html deleted file mode 100644 index 6acaafdc..00000000 --- a/layouts/_partials/posts/banner.html +++ /dev/null @@ -1,9 +0,0 @@ -{{ $page := . }} -{{ with .Params.banner }} -<img - class="lazy w-full h-auto block rounded-lg{{ if $page.Params.bannerAutoInvert }} dark:invert{{ end }}" - loading="lazy" - data-pagefind-meta="image[src]" - src="{{ . }}" -> -{{ end }} diff --git a/layouts/_partials/posts/comment.html b/layouts/_partials/posts/comment.html deleted file mode 100644 index 90757781..00000000 --- a/layouts/_partials/posts/comment.html +++ /dev/null @@ -1,38 +0,0 @@ -<!-- - Giscus has been abandoned since 2026-01-30, - old data from GitHub Discussion and some other comment systems - has been exported to `data/gicus.json` - They are rendered here if found. ---> -{{ $cutoffDate := time.AsTime "2026-01-30" }} -{{ if .Params.Date.Before $cutoffDate }} - {{ $giscusData := hugo.Data.giscus }} - {{ $pageTitle := .Title }} - {{ range $giscusData }} - {{ if eq .title $pageTitle }} - {{ $url := .url }} - {{ with .comments.nodes }} - <details> - <summary class="text-size-sm text-secondary cursor-pointer">博客的评论区已经被禁用,旧的数据已经导出,可以点击这行字查看。</summary> - <div class="my-4"> - {{ range . }} - <div class="text-md py-4 px-1"> - <div class="mb-4 flex justify-between"> - <span class="font-bold">{{ .author.login }}</span> - <span class="text-secondary">{{ .createdAt | time.Format "2006/01/02" }}</span> - </div> - <div> - {{ .body | markdownify }} - </div> - </div> - {{ end }} - </div> - {{ with $url }} - <p><a href="{{ . }}" class="small-button" target="_blank">Full GitHub Discussion →</a></p> - {{ end }} - <hr /> - </details> - {{ end }} - {{ end }} - {{ end }} -{{ end }} diff --git a/layouts/_partials/posts/endnotes.html b/layouts/_partials/posts/endnotes.html deleted file mode 100644 index 107ffd77..00000000 --- a/layouts/_partials/posts/endnotes.html +++ /dev/null @@ -1,13 +0,0 @@ -{{ if .Params.endnotes }} -<hr> -<div id="post-endnotes" class="text-secondary text-4"> - <ul class="list-none"> - {{ range .Params.endnotes }} - <li class="flex gap-4 pl-4"> - <span>→</span> - <span>{{ . | markdownify }}</span> - </li> - {{ end }} - </ul> -</div> -{{ end }} diff --git a/layouts/_partials/posts/fediverse-form.html b/layouts/_partials/posts/fediverse-form.html deleted file mode 100644 index faff355f..00000000 --- a/layouts/_partials/posts/fediverse-form.html +++ /dev/null @@ -1,14 +0,0 @@ -{{ if .Params.toot }} -<div class="flex flex-col gap-2"> - <h4 class="text-sm font-semibold m-0 dark:text-white">{{ T "actionMenu.fediverse" }}</h4> - <input type="text" id="fediverse-instance" placeholder="{{ T "actionMenu.fediversePlaceholder" }}" class="text-sm px-2 py-1 border border-neutral-300 dark:border-neutral-600 rounded bg-transparent dark:text-white"> - <div class="flex gap-2"> - <button id="fediform-copy-button" class="text-xs px-2 py-1 bg-neutral-100 dark:bg-neutral-700 rounded hover:bg-neutral-200 dark:hover:bg-neutral-700 transition-colors">📋</button> - - <button id="fediform-button" class="w-full text-xs px-2 py-1 bg-neutral-200 dark:bg-neutral-600 rounded hover:bg-neutral-300 dark:hover:bg-neutral-500 transition-colors">{{ T "actionMenu.openToot" }}</button> - </div> -</div> -<script> - const tootUrl = '{{ .Params.toot }}' -</script> -{{ end }} diff --git a/layouts/_partials/posts/toc.html b/layouts/_partials/posts/toc.html deleted file mode 100644 index 0bc96782..00000000 --- a/layouts/_partials/posts/toc.html +++ /dev/null @@ -1,10 +0,0 @@ -{{ $top := cond (eq .Section "posts") "top-[19rem]" (cond (eq .Section "library") "top-[34rem]" "top-[17rem]") }} -{{ if .Params.toc }} -<div id="toc-container" - class="absolute bottom-0 left-[calc(50%_+_var(--page-width)_/_2)] right-auto - h-full w-[calc(50%_-_var(--page-width)_/_2)] {{ $top }} hidden lg:block"> - <div id="toc" - class="sticky top-12 text-size-xs xl:text-size-sm 2xl:text-size-base w-full" - >{{ .TableOfContents }}</div> -</div> -{{ end }} diff --git a/layouts/_partials/posts/webmention-form.html b/layouts/_partials/posts/webmention-form.html deleted file mode 100644 index 4499f89b..00000000 --- a/layouts/_partials/posts/webmention-form.html +++ /dev/null @@ -1,6 +0,0 @@ -<form action="https://wm.geedea.pro/endpoint" method="POST" class="flex flex-col gap-2"> - <h4 class="text-sm font-semibold m-0 dark:text-white">{{ T "actionMenu.webmention" }}</h4> - <input type="url" name="source" placeholder="{{ T "actionMenu.webmentionPlaceholder" }}" class="text-sm px-2 py-1 border border-neutral-300 dark:border-neutral-600 rounded bg-transparent dark:text-white"> - <input type="hidden" name="target" value="{{ .Permalink }}"> - <button type="submit" class="text-xs px-2 py-1 bg-neutral-200 dark:bg-neutral-600 rounded hover:bg-neutral-300 dark:hover:bg-neutral-500 transition-colors">{{ T "actionMenu.send" }}</button> -</form> diff --git a/layouts/_partials/posts/webmention-mentions.html b/layouts/_partials/posts/webmention-mentions.html deleted file mode 100644 index e4744bf7..00000000 --- a/layouts/_partials/posts/webmention-mentions.html +++ /dev/null @@ -1,56 +0,0 @@ -{{ with . }} -<section class="my-4"> -<ul class="list-none p-0 m-0"> -{{ range . }} - {{ if index . "microformats" }} - {{ $mf := index . "microformats" "properties" }} - {{ $author := dict }} - {{ if $mf.author }} - {{ if reflect.IsSlice $mf.author }} - {{ $authorElem := index $mf.author 0 }} - {{ if reflect.IsMap $authorElem }} - {{ $author = index $authorElem "properties" }} - {{ else }} - {{ $author = $authorElem }} - {{ end }} - {{ else }} - {{ $author = $mf.author }} - {{ end }} - {{ end }} - {{ if eq (index .microformats.type 0) "h-card" }} - {{ $author = $mf }} - {{ end }} - {{ $photo := "" }} - {{ $authorName := "" }} - {{ $authorUrl := "" }} - - {{ if reflect.IsMap $author }} - {{ $photo = or (index . "extra" "proxied-photo") (index $author.photo 0) }} - {{ $authorName = index $author.name 0 }} - {{ $authorUrl = index $author.url 0 }} - {{ else }} - {{ $photo = index . "extra" "proxied-photo" }} - {{ $authorName = $author }} - {{ $authorUrl = .webmention.source }} - {{ end }} - - <li class="flex gap-2"> - {{ if $photo }} - <img src="{{ $photo }}" class="h-5 w-5 rd-full inline m-0"> - {{ else }} - <div class="h-5 w-5 rd-full m-0 bg-neutral-300"></div> - {{ end }} - <a href="{{ $authorUrl }}" target="_blank">{{ $authorName }}</a> - <a href="{{ .webmention.source }}" target="_blank">{{ T "webmention.mentionedThisPost" . }}</a> - </li> - {{ else }} - <li class="flex gap-2"> - {{ $u := urls.Parse .webmention.source }} - <div class="h-5 w-5 rd-full m-0 bg-neutral-300"></div> - <span>{{ $u.Hostname }}</span> - <a href="{{ .webmention.source }}" target="_blank">{{ T "webmention.mentionedThisPost" . }}</a></li> - {{ end }} -{{ end }} -</ul> -</section> -{{ end }} diff --git a/layouts/_partials/posts/webmention-replies.html b/layouts/_partials/posts/webmention-replies.html deleted file mode 100644 index 66b64ef9..00000000 --- a/layouts/_partials/posts/webmention-replies.html +++ /dev/null @@ -1,69 +0,0 @@ -{{ with . }} -<section class="flex flex-col gap-4 bg-[var(--background-color)]"> -{{ range . }} - {{ $reply := index . "microformats" "properties" }} - {{ $author := dict }} - {{ $photo := "" }} - - {{ if $reply.author }} - {{ if reflect.IsSlice $reply.author }} - {{ $authorElem := index $reply.author 0 }} - {{ if reflect.IsMap $authorElem }} - {{ $author = index $authorElem "properties" }} - {{ else }} - {{ $author = $authorElem }} - {{ end }} - {{ $photo = or (index $author.photo 0) (index $reply.photo 0) }} - {{ else }} - {{ $author = $reply.author }} - {{ $photo = index $reply.photo 0 }} - {{ end }} - {{ end }} - -<div class="relative"> - <header class="flex justify-between items-start"> - <div class="flex items-center gap-3"> - <img src="{{ $photo }}" alt="Profile Picture" - class="h-8 w-8 rd-full" loading="lazy" /> - <div class="text-secondary"> - <p class="font-bold m-0"> - <a href="{{ if reflect.IsMap $author }} - {{ or (index $author.url 0) (index $reply.url 0) }} - {{ else }} - {{ index $reply.url 0 }} - {{ end }}"> - {{ if reflect.IsMap $author }} - {{ replaceRE ":.*?:" "" (index $author.name 0) }} - {{ else }} - {{ $author }} - {{ end }} - </a> - </p> - {{ $time := (index $reply.published 0) }} - {{ $isFormated := strings.Contains $time " " }} - {{ if not $isFormated }} - {{ $t := time.AsTime $time }} - {{ $time = time.Format "2006-1-2 15:04" $t }} - {{ end }} - <p class="m-0"><time>{{ $time }}</time></p> - </div> - </div> - <div class="flex items-start"> - <a href="{{ .webmention.source }}" target="_blank" - title="{{ T "viewExternalSource" }}" - data-tooltip>↗</a> - </div> - </header> - - <div class="max-h-[500px] overflow-y-auto overflow-x-hidden"> - <div class="webmention-body markdown-body leading-relaxed ml-3 pl-4 pr-2 b-l-4 b-l-solid b-neutral-200/50 dark:b-neutral-700/50"> - {{ index (index $reply.content 0) "html" | safeHTML }} - {{ if strings.Contains .webmention.source "https://brid.gy" }} - <p class="text-xs text-right text-secondary">通过 <a href="https://brid.gy/" target="_blank">Bridgy</a> 发送自联邦宇宙</p> - {{ end }} - </div> - </div> -</div> -{{ end }} -</section> -{{ end }} diff --git a/layouts/_partials/posts/webmention-summary.html b/layouts/_partials/posts/webmention-summary.html deleted file mode 100644 index 18be7344..00000000 --- a/layouts/_partials/posts/webmention-summary.html +++ /dev/null @@ -1,54 +0,0 @@ -{{ $likes := .likes }} -{{ $page := .page }} -{{ $othercount := .othercount }} - -<section class="group relative mb-6 vertical-middle"> - <!-- Action Area Toggle --> - <button - popovertarget="action-area" - data-tooltip - title="{{ T "actionMenu.interact" }}" - class="m-0 p-0 bg-transparent hover:no-underline cursor-pointer float-left mr-2"> - <div class="w-5 h-5 bg-neutral-200 dark:bg-neutral-600 flex justify-center items-center rd-full font-800">+</div> - </button> - - <!-- Likes --> - {{ range $likes }} - {{ $authors := index . "microformats" "properties" "author" }} - {{ $author := dict }} - {{ $photo := "" }} - {{ if $authors }} - {{ if reflect.IsSlice $authors }} - {{ $authorElem := index $authors 0 }} - {{ if reflect.IsMap $authorElem }} - {{ $author = index $authorElem "properties" }} - {{ else }} - {{ $author = $authorElem }} - {{ end }} - {{ else }} - {{ $author = $authors }} - {{ end }} - {{ end }} - {{ $photo = or (index . "extra" "proxied-photo") (index $author.photo 0) }} - <a href="{{ if reflect.IsMap $author }}{{ index $author.url 0 }}{{ else }}#{{ end }}" target="_blank" title="{{ if reflect.IsMap $author }}{{ index $author.name 0 }}{{ else }}{{ $author }}{{ end }}" class="box-border hover:no-underline inline-block h-5 w-5 float-left -ml-1 hover:scale-150 transition-transform"> - {{ $value := math.Floor (mul math.Rand 80) }} - {{ $rotate := cond (lt $value 40) (sub 10 $value) (sub $value 30) }} - {{ if $photo }} - <img src="{{ $photo }}" alt="Profile Picture" - loading="lazy" - class="h-5 w-5 rd-full transition-transform" - style="{{ if ne $rotate 0 }}--rotate-amount: {{ $rotate }}deg;{{ end }}" /> - {{ else }} - <div class="h-5 w-5 rd-full bg-neutral-300"></div> - {{ end }} - </a> - {{ end }} - <div class="text-secondary m-0 text-sm inline ml-2"> - {{ printf (T "webmention.likedBy") (len $likes ) }} - {{ if gt $othercount 0 }} - {{ printf (T "webmention.repliedAndMentionedBy") $othercount }} - {{ end }} - </div> - <div class="clear-left"></div> -</section> - diff --git a/layouts/_partials/posts/webmention.html b/layouts/_partials/posts/webmention.html deleted file mode 100644 index 77b89f25..00000000 --- a/layouts/_partials/posts/webmention.html +++ /dev/null @@ -1,73 +0,0 @@ -{{ $page := . }} -{{ $currentPagePath := .RelPermalink }} -{{ $webmentions_url := .Site.Params.webmention.src }} - -{{ with try (resources.GetRemote $webmentions_url) }} - {{ 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> - {{ with $page.Params.toot }} - <p class="text-secondary text-sm"> - {{ $link := printf "<a href=\"%s\" target=\"_blank\">Eucalyptus</a>" . }} - *{{ printf (T "webmention.bridgyNotice") $link | safeHTML }} - </p> - {{ end }} - <div id="webmention-details"> - {{ partial "posts/webmention-replies" $replies }} - {{ partial "posts/webmention-mentions" $mentions }} - </div> - </details> - {{ else }} - <p>Unable to fetch webmentions. Please contact webmaster.</p> - {{ end }} -{{ end }} |
