From eef64c6a142129cf7130c7d5825baf593156de74 Mon Sep 17 00:00:00 2001 From: slurdge Date: Thu, 16 Mar 2023 15:34:03 +0100 Subject: [PATCH] feat: add a second arg to image, 'link', which put a link to the entry associated with the image. --- internal/goeland/filters/filter.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/internal/goeland/filters/filter.go b/internal/goeland/filters/filter.go index 586bc61..ed3d05b 100644 --- a/internal/goeland/filters/filter.go +++ b/internal/goeland/filters/filter.go @@ -235,8 +235,20 @@ func filterEmbedImage(source *goeland.Source, params *filterParams) { } } } + includeEntryLink := false + if len(args) > 1 { + if strings.ToLower(args[1]) == "link" { + includeEntryLink = true + } + } for i, entry := range source.Entries { + if strings.TrimSpace(entry.ImageURL) == "" { + continue + } imageLink := fmt.Sprintf(``, entry.ImageURL, positions[position]) + if includeEntryLink { + imageLink = fmt.Sprintf(`%s`, entry.URL, imageLink) + } switch position { case 0: entry.Content = imageLink + entry.Content