From c61224f71c60e3c466ff7f48dd5fdeb2111552bb Mon Sep 17 00:00:00 2001 From: BigCoke233 Date: Thu, 22 Jan 2026 23:12:06 +0800 Subject: feat: display recently added bookmarks in linkroll page --- content/linkroll.md | 6 ++- layouts/_shortcodes/linkding-bookmarks.html | 62 +++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 layouts/_shortcodes/linkding-bookmarks.html 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 }} +
+ {{ range $items }} +
+

+ + {{ .title }} + +

+ {{ if .description }} +

{{ .description }}

+ {{ end }} + {{ if .category }} +
+ {{ if reflect.IsSlice .category }} + {{ range .category }} + + #{{ . }} + + {{ end }} + {{ else }} + + #{{ .category }} + + {{ end }} +
+ {{ end }} +
+ 于 {{ dateFormat "2006-01-02" .pubDate }} 添加至书签 +
+
+ {{ end }} +
+ {{ else }} +

No bookmarks found in RSS feed.

+ {{ end }} + {{ else }} +

Unable to parse RSS feed.

+ {{ end }} +{{ else }} +

RSS feed file not found. Please run the GitHub Action to fetch the feed.

+{{ end }} -- cgit v1.2.3