-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy patharticles.hugo.html
More file actions
109 lines (100 loc) · 3.57 KB
/
articles.hugo.html
File metadata and controls
109 lines (100 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
{{/*
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 }}
{{ $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 }}
{{ with $args.more }}
{{ if .title }}{{ $moreTitle = .title }}{{ end }}
{{ if .link }}{{ $moreLink = .link }}{{ 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 }}
<div class="container-xxl p-4 px-xxl-0">
{{- partial "assets/section-title.html" (dict "heading" $args.heading "class" "py-5") -}}
{{ $partial := "assets/card-group.html" }}
{{ $params := dict }}
{{- $params = merge $params (dict
"page" page
"list" $pages
"max" $args.max
"cols" $args.cols
"icon-rounded" $args.iconRounded
"href" (cond $moreButton $moreLink "")
"href-title" (cond $moreButton $moreTitle "")
"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
"padding" 3
"ratio" "1x1"
"orientation" "horizontal-sm"
"styles" (cond $args.bento $styles "")
) -}}
{{ else }}
{{ $params = merge $params (dict
"header-style" $args.headerStyle
"footer-style" $args.footerStyle
"padding" $args.padding
"class" (or $args.class "border-0")
"icon-style" "fa-2x"
"align" "start"
"orientation" $args.orientation
"hook" "assets/live-card.html"
"pagination" $args.pagination
"paginate" $paginate
) -}}
{{ end }}
{{ partial $partial $params }}
</div>
{{ end }}