Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add the hb.blog.list_style parameter, available option: minimalist #866

Merged
merged 1 commit into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ path = "github.com/hugomods/images"
paginate = 12
profile = true
profile_metrics = true
list_style = "" # available options: minimalist.

[params.hb.blog]
list_style = "" # available options: minimalist.
full_width = false
paginate = 12
post_date_format = ':date_long'
Expand Down
37 changes: 27 additions & 10 deletions layouts/_default/term.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,34 @@
{{- if default true site.Params.hb.terms.profile }}
{{ partialCached "hb/modules/blog/term/profile" . . }}
{{- end }}
{{- $cols := "row-cols-1 row-cols-md-2" }}
{{- if not (partialCached "hb/modules/blog/functions/has-sidebar" .) }}
{{- $cols = printf "%s row-cols-lg-3" $cols }}
{{- end }}
<div class="hb-terms-posts row {{ $cols }}">
{{- range .Paginator.Pages }}
<div class="mb-3 mb-lg-4">
{{ partial "hb/modules/blog/post/card" (dict "Page" .) }}
</div>
{{- if eq site.Params.hb.terms.list_style "minimalist" }}
<div class="hb-blog-posts hb-terms-posts hb-module">
{{- range .Paginator.Pages }}
<div class="hb-blog-post hb-terms-post">
<a class="hb-blog-post-title-link d-flex" href="{{ .RelPermalink }}">
<span class="me-md-1">
{{ .Title }}
</span>
<span class="hb-blog-post-meta ms-auto d-none d-md-block text-body-secondary text-nowrap">
{{ .Date | time.Format site.Params.hb.blog.post_date_format }}
</span>
</a>
</div>
{{- end }}
</div>
{{- else }}
{{- $cols := "row-cols-1 row-cols-md-2" }}
{{- if not (partialCached "hb/modules/blog/functions/has-sidebar" .) }}
{{- $cols = printf "%s row-cols-lg-3" $cols }}
{{- end }}
</div>
<div class="hb-terms-posts row {{ $cols }}">
{{- range .Paginator.Pages }}
<div class="mb-3 mb-lg-4">
{{ partial "hb/modules/blog/post/card" (dict "Page" .) }}
</div>
{{- end }}
</div>
{{- end }}
{{ partial "hb/modules/pagination/index" .Paginator }}
{{ partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-main-end" "Page" .) }}
</div>
Expand Down
8 changes: 6 additions & 2 deletions layouts/partials/hb/modules/blog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@
</div>
{{- end }}
{{- with .Paginator }}
{{- $cols := partialCached "hb/modules/blog/functions/list-cols" . }}
{{ partial "hb/modules/blog/posts" (dict "Pages" .Pages "Cols" $cols) }}
{{- if eq site.Params.hb.blog.list_style "minimalist" }}
{{ partial "hb/modules/blog/posts-minimalist" (dict "Pages" .Pages) }}
{{- else }}
{{- $cols := partialCached "hb/modules/blog/functions/list-cols" . }}
{{ partial "hb/modules/blog/posts" (dict "Pages" .Pages "Cols" $cols) }}
{{- end }}
{{ partial "hb/modules/pagination/index" . }}
{{- end }}
</div>
Expand Down
8 changes: 6 additions & 2 deletions layouts/partials/hb/modules/blog/list.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<div class="hb-blog-main-container">
<div class="hb-blog-main">
{{ partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-main-begin" "Page" .) }}
{{- $cols := partialCached "hb/modules/blog/functions/list-cols" . }}
{{ partial "hb/modules/blog/posts" (dict "Pages" .Paginator.Pages "Cols" $cols) }}
{{- if eq site.Params.hb.blog.list_style "minimalist" }}
{{ partial "hb/modules/blog/posts-minimalist" (dict "Pages" .Paginator.Pages) }}
{{- else }}
{{- $cols := partialCached "hb/modules/blog/functions/list-cols" . }}
{{ partial "hb/modules/blog/posts" (dict "Pages" .Paginator.Pages "Cols" $cols) }}
{{- end }}
{{ partial "hb/modules/pagination/index" .Paginator }}
{{ partial "hugopress/functions/render-hooks" (dict "Name" "hb-blog-main-end" "Page" .) }}
</div>
Expand Down
14 changes: 14 additions & 0 deletions layouts/partials/hb/modules/blog/posts-minimalist.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div class="hb-blog-posts hb-module">
{{- range .Pages }}
<div class="hb-blog-post">
<a class="hb-blog-post-title-link d-flex" href="{{ .RelPermalink }}">
<span class="me-md-1">
{{ .Title }}
</span>
<span class="hb-blog-post-meta ms-auto d-none d-md-block text-body-secondary text-nowrap">
{{ .Date | time.Format site.Params.hb.blog.post_date_format }}
</span>
</a>
</div>
{{- end }}
</div>
Loading