mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-12 20:15:25 +00:00
feat(widget): add option to link to archive from Feature widget (#1557)
To add a "See all" link underneath featured content, set `link_to_archive = true` under the `[content]` section in the front matter of the Featured widget.
This commit is contained in:
1 parent
4834058bfe
commit
337a554a25
2 files changed
+25
No files matched your search
@@ -21,6 +21,9 @@ subtitle = ""
|
||||
# Page order. Descending (desc) or ascending (asc) date.
|
||||
order = "desc"
|
||||
|
||||
# Show a "See all pages" link underneath the featured content?
|
||||
link_to_archive = false
|
||||
|
||||
# Filter posts by a taxonomy term.
|
||||
[content.filters]
|
||||
tag = ""
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
{{/* Query */}}
|
||||
{{ $query := where (where site.RegularPages "Type" $items_type) "Params.featured" true }}
|
||||
{{ $archive_page := site.GetPage "Section" $items_type }}
|
||||
|
||||
{{/* Filters */}}
|
||||
{{ if $st.Params.content.filters.tag }}
|
||||
@@ -31,6 +32,18 @@
|
||||
{{/* Limit */}}
|
||||
{{ $query = first $items_count $query }}
|
||||
|
||||
{{/* Localisation */}}
|
||||
{{ $i18n := "" }}
|
||||
{{ if eq $items_type "post" }}
|
||||
{{ $i18n = "more_posts" }}
|
||||
{{ else if eq $items_type "talk" }}
|
||||
{{ $i18n = "more_talks" }}
|
||||
{{ else if eq $items_type "publication" }}
|
||||
{{ $i18n = "more_publications" }}
|
||||
{{ else }}
|
||||
{{ $i18n = "more_pages" }}
|
||||
{{ end }}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-4 section-heading">
|
||||
<h1>{{ with $st.Title }}{{ . | markdownify | emojify }}{{ end }}</h1>
|
||||
@@ -52,5 +65,14 @@
|
||||
{{ end }}
|
||||
{{end}}
|
||||
|
||||
{{ if $st.Params.content.link_to_archive }}
|
||||
<div class="see-all">
|
||||
<a href="{{ $archive_page.RelPermalink }}">
|
||||
{{ i18n $i18n | default "See all" }}
|
||||
<i class="fas fa-angle-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
Reference in new issue
Block a user