From 9eaac4f8b504907b4674c9253509bd1c43cfdb28 Mon Sep 17 00:00:00 2001 From: Max Mehl Date: Mon, 17 Mar 2025 14:22:19 +0100 Subject: [PATCH] start work to implement a 'read further' separator for the links Problems: The JS based selectors lead to strange results as in the top5 list there might me no items in the first 5 left. Perhaps a JS-only solution might make sense in the long run --- content/links.md | 2 +- .../layouts/shortcodes/links.html | 20 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/content/links.md b/content/links.md index 2cb0f4b..df55f00 100644 --- a/content/links.md +++ b/content/links.md @@ -13,7 +13,7 @@ You can click on the buttons to select only links with the given language or top A selection of my presentations and radio shows I participated in. By clicking on the respective icons you can watch the video recording, access the slides and listen to the audio recording. -{{< links type="av" >}} +{{< links type="av" limit="5" >}} ## Appearance in Media {#media} diff --git a/themes/hugo-sustain/layouts/shortcodes/links.html b/themes/hugo-sustain/layouts/shortcodes/links.html index b3b6010..78b3873 100644 --- a/themes/hugo-sustain/layouts/shortcodes/links.html +++ b/themes/hugo-sustain/layouts/shortcodes/links.html @@ -2,9 +2,22 @@ {{- $data := .Site.Data.links -}} {{- if $type -}} {{- $data = where $data "type" $type -}} -{{ end }} +{{- end }} +{{- $data = sort $data "date" "desc" }} +{{- $datalen := $data | len }} +{{- $limit := (.Get "limit" | default -1) | int }} +{{- $limit_trigger := false }}