summaryrefslogtreecommitdiff
path: root/layouts/_default/stats.html
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-05-23 19:48:12 +0800
committerEltrac <hi@guhub.cn>2025-05-23 19:48:12 +0800
commit0d2166cc8da8d6c7940c2fe1d7a626d962b4ee37 (patch)
treeb672cdf6eb2cc4135977d3e1ff9091ae2777c417 /layouts/_default/stats.html
parente50c574d8d969a38eb1c3068b537fa220503adb7 (diff)
feat: change links to stats, add to postnav, and better style
Diffstat (limited to 'layouts/_default/stats.html')
-rw-r--r--layouts/_default/stats.html89
1 files changed, 89 insertions, 0 deletions
diff --git a/layouts/_default/stats.html b/layouts/_default/stats.html
new file mode 100644
index 00000000..2d80ca05
--- /dev/null
+++ b/layouts/_default/stats.html
@@ -0,0 +1,89 @@
+{{ define "main" }}
+ <style>
+ #external-link-rank {
+ padding: 0;
+ margin: 0;
+ max-height: 700px;
+ overflow-y: auto;
+ box-sizing: border-box;
+ }
+
+ .rank-item {
+ list-style: none;
+ width: 100%;
+ margin: 0.5rem 0;
+ box-sizing: border-box;
+ padding: 0.1rem 0.5rem;
+ position: relative;
+ }
+ .rank-item-text {
+ margin-bottom: 0.2rem;
+ display: flex;
+ justify-content: space-between;
+ }
+ .rank-item-link {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.5rem;
+ }
+ .rank-item-link img {
+ width: 1rem;
+ height: 1rem;
+ }
+ .rank-item-bar {
+ background-color: rgba(103,173,91,0.35);
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ z-index: -1;
+ }
+ </style>
+
+ <article>
+ {{ partial "header.html" . }}
+ {{ partial "components/postnav.html" . }}
+
+ <div class="markdown-content" style="line-height: 2">
+ {{ .Content }}
+ </div>
+
+ <h2>内部链接图谱</h2>
+ <div class="outbox small">
+ <iframe src="https://geedea.pro/graph"
+ style="width:100%;height: 30rem;border-radius:5px;border:none"></iframe>
+ </div>
+
+ <h2>外部链接排行</h2>
+
+ {{/* Find the maximum link count */}}
+ {{ $max := 0 }}
+ {{ range .Site.Data.externallinks }}
+ {{ if gt (index . 1) $max }}
+ {{ $max = index . 1 }}
+ {{ end }}
+ {{ end }}
+
+ <ol id="external-link-rank">
+ {{ range .Site.Data.externallinks }}
+ {{ $label := index . 0 }}
+ {{ $count := index . 1 }}
+ {{ if gt $count 2 }}
+ {{ $percent := div (mul $count 100) $max }}
+ <li class="rank-item">
+ <div class="rank-item-text">
+ <a class="rank-item-link" href="https://{{ $label }}/" target="_blank">
+ <img src="https://favicone.com/{{ $label }}?s=50" />
+ {{ $label }}
+ </a>
+ <span>{{ $count }}</span>
+ </div>
+ <div class="rank-item-bar" style="width:{{ $percent }}%"></div>
+ </li>
+ {{ end }}
+ {{ end }}
+ </ol>
+ </article>
+ {{ partial "footer.html" . }}
+{{ end }}