mirror of
https://github.com/gethinode/hinode.git
synced 2025-10-07 18:14:28 +00:00
127 lines
4.2 KiB
HTML
127 lines
4.2 KiB
HTML
{{/*
|
|
Copyright © 2025 The Hinode Team / Mark Dumay. All rights reserved.
|
|
Use of this source code is governed by The MIT License (MIT) that can be found in the LICENSE file.
|
|
Visit gethinode.com/license for more details.
|
|
*/}}
|
|
|
|
{{ $error := false }}
|
|
|
|
{{/* Initialize arguments */}}
|
|
{{ $args := partial "utilities/InitArgs.html" (dict "bookshop" "articles" "args" .)}}
|
|
{{ if or $args.err $args.warnmsg }}
|
|
{{ partial (cond $args.err "utilities/LogErr.html" "utilities/LogWarn.html") (dict
|
|
"partial" "component-library/components/articles/articles.hugo.html"
|
|
"warnid" "warn-invalid-arguments"
|
|
"msg" "Invalid arguments"
|
|
"details" ($args.errmsg | append $args.warnmsg)
|
|
"file" page.File
|
|
)}}
|
|
{{ $error = $args.err }}
|
|
{{ end }}
|
|
|
|
{{/* Initialize global arguments */}}
|
|
{{- $padding := partial "utilities/GetPadding.html" -}}
|
|
|
|
{{/* Initialize local variables */}}
|
|
{{ $pages := slice }}
|
|
{{ $result := partial "assets/live-pages.html" (dict
|
|
"page" $args.page
|
|
"section" $args.input.section
|
|
"nested" $args.input.nested
|
|
"keywords" $args.input.keywords
|
|
"categories" $args.input.categories
|
|
"tags" $args.input.tags
|
|
"sort" $args.input.sort
|
|
"reverse" $args.input.reverse
|
|
)}}
|
|
{{ $pages = $result.pages }}
|
|
|
|
<!-- Add style definitions -->
|
|
{{ $styles := slice
|
|
(dict "ratio" "1x1" "orientation" "overlay" "portrait" false "width" "6")
|
|
(dict "ratio" "4x3" "orientation" "stacked" "portrait" true "width" "3")
|
|
(dict "ratio" "1x1" "orientation" "stacked" "portrait" false "width" "3")
|
|
(dict "ratio" "16x9" "orientation" "stacked" "portrait" true "width" "3")
|
|
(dict "ratio" "1x1" "orientation" "stacked" "portrait" false "width" "3")
|
|
}}
|
|
|
|
<!-- Define more button -->
|
|
{{ $moreButton := site.Params.modules.bookshop.articles.moreButton | default false }}
|
|
{{ $moreTitle := T "more" (pluralize $args.input.section) }}
|
|
{{ $moreLink := $args.input.section }}
|
|
{{ $moreType := "button" }}
|
|
{{ $moreIcon := "" }}
|
|
{{ with $args.more }}
|
|
{{ if .title }}{{ $moreTitle = .title }}{{ end }}
|
|
{{ if .link }}{{ $moreLink = .link }}{{ end }}
|
|
{{ if index . "link-type" }}{{ $moreType = index . "link-type" }}{{ end }}
|
|
{{ if .icon }}{{ $moreIcon = .icon }}{{ end }}
|
|
{{ end }}
|
|
|
|
{{ $paginate := $args.paginate }}
|
|
{{ if and $paginate page.IsPage }}
|
|
{{ partial "utilities/LogWarn.html" (dict
|
|
"partial" "component-library/components/articles/articles.hugo.html"
|
|
"msg" "Pagination not supported"
|
|
"file" page.File
|
|
)}}
|
|
{{ $paginate = false }}
|
|
{{ end }}
|
|
|
|
{{/* Main code */}}
|
|
{{ if not $error }}
|
|
{{ if or (gt (len $pages) 0) (not $args.hideEmpty) }}
|
|
{{- partial "assets/section-title.html" (dict
|
|
"heading" $args.heading
|
|
"justify" $args.justify
|
|
"class" (printf "pb-%d" $padding.y))
|
|
-}}
|
|
|
|
{{ $partial := "assets/card-group.html" }}
|
|
{{ $params := dict }}
|
|
{{- $params = merge $params (dict
|
|
"page" page
|
|
"list" $pages
|
|
"cols" $args.cols
|
|
"limit" $args.limit
|
|
"padding" $args.padding
|
|
"href" (cond $moreButton $moreLink "")
|
|
"href-force" (gt $result.total (len $result.pages))
|
|
)}}
|
|
|
|
{{ if $args.scroll }}
|
|
{{ $partial = "assets/stack.html" }}
|
|
{{ $params = merge $params (dict
|
|
"header-style" "none"
|
|
"body-style" "title"
|
|
"footer-style" "none"
|
|
"gutter" 1
|
|
"ratio" "1x1"
|
|
"orientation" "horizontal-sm"
|
|
"styles" (cond $args.bento $styles "")
|
|
) -}}
|
|
{{ else }}
|
|
{{ $params = merge $params (dict
|
|
"header-style" $args.headerStyle
|
|
"body-style" $args.bodyStyle
|
|
"footer-style" $args.footerStyle
|
|
"class" (or $args.class "border-0")
|
|
"align" "start"
|
|
"orientation" $args.orientation
|
|
"href-title" (cond $moreButton $moreTitle "")
|
|
"icon-rounded" $args.iconRounded
|
|
"icon-style" $args.iconStyle
|
|
"hook" "assets/live-card.html"
|
|
"more-link-type" $moreType
|
|
"more-link-icon" $moreIcon
|
|
"pagination" $args.pagination
|
|
"paginate" $paginate
|
|
) -}}
|
|
{{ end }}
|
|
{{ if gt (len $pages) 0 }}
|
|
{{ partial $partial $params }}
|
|
{{ else }}
|
|
<p class="pt-{{ $padding.y }}">{{- T "emptyList" }}.</p>
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }} |