diff options
Diffstat (limited to 'layouts/_shortcodes/linkding-bookmarks.html')
| -rw-r--r-- | layouts/_shortcodes/linkding-bookmarks.html | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/layouts/_shortcodes/linkding-bookmarks.html b/layouts/_shortcodes/linkding-bookmarks.html deleted file mode 100644 index fd54c0d2..00000000 --- a/layouts/_shortcodes/linkding-bookmarks.html +++ /dev/null @@ -1,68 +0,0 @@ -{{/* -Shortcode to display Linkding RSS feed bookmarks -Usage: {{< linkding-bookmarks >}} -*/}} - -{{/* Fetch RSS feed from remote URL with caching */}} -{{ $url := "https://links.eltr.ac/feeds/shared?limit=12" }} -{{ $cacheKey := print $url (now.Format "2006-01-02") }} -{{ $rssContent := resources.GetRemote $url - (dict - "key" $cacheKey - "headers" (dict "User-Agent" "Hugo/1.0") - ) -}} - -{{ if $rssContent }} - {{/* Parse RSS XML */}} - {{ $rss := $rssContent.Content | 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>Unable to fetch RSS feed from remote URL.</p> -{{ end }} |
