From 161cdb903ec3843ca18649fc1458f4748e8316fa Mon Sep 17 00:00:00 2001 From: George Cushen Date: Fri, 4 Dec 2020 16:25:23 +0000 Subject: [PATCH] feat(widget): add support to customize See All link in Featured widget Documentation: https://github.com/wowchemy/wowchemy-hugo-modules/issues/1800#issuecomment-678817441 BREAKING CHANGE Removes the old experimental option `content.link_to_archive` Follows on from Pages widget implementation in 05bfd7c See #1800 --- .../layouts/partials/widgets/featured.html | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/wowchemy/layouts/partials/widgets/featured.html b/wowchemy/layouts/partials/widgets/featured.html index 8e561946..a9b5c096 100644 --- a/wowchemy/layouts/partials/widgets/featured.html +++ b/wowchemy/layouts/partials/widgets/featured.html @@ -29,6 +29,8 @@ {{ $query = $query | intersect $archive_page.Pages }} {{ end }} +{{ $count := len $query }} + {{/* Sort */}} {{ $sort_by := "Date" }} {{ $query = sort $query $sort_by $items_sort }} @@ -66,10 +68,22 @@ {{ end }} {{end}} - {{ if $st.Params.content.link_to_archive }} + {{/* Archive link */}} + {{ $show_archive_link := $st.Params.content.archive.enable | default (gt $count $items_count) }} + {{ if $show_archive_link }} + + {{ $archive_link := "" }} + {{ if $st.Params.content.archive.link }} + {{ $archive_link = $st.Params.content.archive.link | relLangURL }} + {{ else }} + {{ $archive_link = $archive_page.RelPermalink }} + {{ end }} + + {{ $archive_text := $st.Params.content.archive.text | default (i18n $i18n) | default "See all" }} +
- - {{ i18n $i18n | default "See all" }} + + {{ $archive_text | emojify }}