summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBigCoke233 <hi@guhub.cn>2026-01-22 23:12:06 +0800
committerBigCoke233 <hi@guhub.cn>2026-01-22 23:12:06 +0800
commit95e3c339058b5fe4892ec2de2b84765d5425be2a (patch)
treee5c0f025ef72ee4cbceeeda63027397cdcffc3df
parent845c1469ce659abdbe681beb1e1f581756921fa1 (diff)
feat: display recently added bookmarks in linkroll page
Former-commit-id: c61224f71c60e3c466ff7f48dd5fdeb2111552bb
-rw-r--r--content/linkroll.md6
-rw-r--r--layouts/_shortcodes/linkding-bookmarks.html62
2 files changed, 67 insertions, 1 deletions
diff --git a/content/linkroll.md b/content/linkroll.md
index 9f8b494c..50753436 100644
--- a/content/linkroll.md
+++ b/content/linkroll.md
@@ -20,7 +20,11 @@ aliases:
## 我的书签
-我自建有一个 Linkding 实例,你可以在[这里](https://links.guhub.cn/bookmarks/shared)查看我收藏并分享的所有链接。
+我自建有一个 Linkding 实例,你可以在[这里](https://links.eltr.ac/bookmarks/shared)查看我收藏并分享的所有链接。
+
+最近添加的书签:
+
+{{< linkding-bookmarks >}}
## 我常听的中文播客
diff --git a/layouts/_shortcodes/linkding-bookmarks.html b/layouts/_shortcodes/linkding-bookmarks.html
new file mode 100644
index 00000000..45109c2a
--- /dev/null
+++ b/layouts/_shortcodes/linkding-bookmarks.html
@@ -0,0 +1,62 @@
+{{/*
+Shortcode to display Linkding RSS feed bookmarks
+Usage: {{< linkding-bookmarks >}}
+*/}}
+
+{{/* Read the RSS feed file */}}
+{{ $rssFile := "data/linkding.xml" }}
+{{ if fileExists $rssFile }}
+ {{ $rssContent := readFile $rssFile }}
+
+ {{/* Parse RSS XML */}}
+ {{ $rss := $rssContent | transform.Unmarshal }}
+
+ {{ if $rss }}
+ {{/* Get channel items */}}
+ {{ $items := $rss.channel.item }}
+
+ {{ if $items }}
+ <div class="linkding-bookmarks">
+ {{ range $items }}
+ <div class="bookmark-item mb-4 p-4 rounded-md" style="background-color: var(--block-background-color);">
+ <h3 class="m-0 mb-2">
+ <a href="{{ .link }}" target="_blank" rel="noopener noreferrer"
+ style="color: var(--text-color); text-decoration: none;">
+ {{ .title }}
+ </a>
+ </h3>
+ {{ if .description }}
+ <p class="m-0 text-sm opacity-80">{{ .description }}</p>
+ {{ end }}
+ {{ if .category }}
+ <div class="mt-2 flex flex-wrap gap-2">
+ {{ if reflect.IsSlice .category }}
+ {{ range .category }}
+ <span class="text-secondary text-xs rounded"
+ style="background-color: var(--border-color-light);">
+ #{{ . }}
+ </span>
+ {{ end }}
+ {{ else }}
+ <span class="text-secondary text-xs rounded"
+ style="background-color: var(--border-color-light);">
+ #{{ .category }}
+ </span>
+ {{ end }}
+ </div>
+ {{ end }}
+ <div class="mt-2 text-xs opacity-60">
+ 于 {{ dateFormat "2006-01-02" .pubDate }} 添加至书签
+ </div>
+ </div>
+ {{ end }}
+ </div>
+ {{ else }}
+ <p>No bookmarks found in RSS feed.</p>
+ {{ end }}
+ {{ else }}
+ <p>Unable to parse RSS feed.</p>
+ {{ end }}
+{{ else }}
+ <p>RSS feed file not found. Please run the GitHub Action to fetch the feed.</p>
+{{ end }}