diff --git a/hugo.toml b/hugo.toml index 32db7251..cf871be4 100644 --- a/hugo.toml +++ b/hugo.toml @@ -19,14 +19,17 @@ path = "github.com/hugomods/icons/vendors/bootstrap" [[module.imports]] path = "github.com/hugomods/images" +[[module.imports]] +path = "github.com/hugomods/masonry-js" + [params.hb.terms] paginate = 12 profile = true profile_metrics = true -list_style = "" # available options: minimalist. +list_style = "" # available options: minimalist, cascade. [params.hb.blog] -list_style = "" # available options: minimalist. +list_style = "" # available options: minimalist, cascade. full_width = false paginate = 12 post_date_format = ':date_long' diff --git a/layouts/_default/term.html b/layouts/_default/term.html index 29918bec..2ba3b5d8 100644 --- a/layouts/_default/term.html +++ b/layouts/_default/term.html @@ -11,7 +11,8 @@ {{- if default true site.Params.hb.terms.profile }} {{ partialCached "hb/modules/blog/term/profile" . . }} {{- end }} - {{- if eq site.Params.hb.terms.list_style "minimalist" }} + {{- $listStyle := site.Params.hb.terms.list_style }} + {{- if eq $listStyle "minimalist" }}
{{- range .Paginator.Pages }}
@@ -34,10 +35,17 @@ {{- if not (partialCached "hb/modules/blog/functions/has-sidebar" .) }} {{- $cols = printf "%s row-cols-lg-3" $cols }} {{- end }} -
+ {{- if eq $listStyle "cascade" }} + {{ partialCached "hugomods/masonry-js/assets/js" . }} + {{- end }} +
{{- range .Paginator.Pages }}
- {{ partial "hb/modules/blog/post/card" (dict "Page" .) }} + {{ partial "hb/modules/blog/post/card" (dict "Page" . "ListStyle" $listStyle "Caller" "list") }}
{{- end }}
diff --git a/layouts/partials/hb/modules/blog/post/card.html b/layouts/partials/hb/modules/blog/post/card.html index d00a8b84..9a0323e7 100644 --- a/layouts/partials/hb/modules/blog/post/card.html +++ b/layouts/partials/hb/modules/blog/post/card.html @@ -11,10 +11,15 @@ {{- $meta := default true .Meta }} {{- $pageMeta := default dict $page.Params.meta }} {{- $modularize := default true .Modularize }} +{{- $listStyle := default "" .ListStyle }} {{- $thumbnail := true }} {{- $thumbnailPos := "top" }} {{- if eq .Caller "list" }} {{- $thumbnail = default true site.Params.hb.blog.post_thumbnail }} + {{- $imgs := partialCached "_funcs/get-page-images" $page $page }} + {{- if eq $listStyle "cascade" }} + {{- $thumbnail = (gt (len $imgs) 0) }} + {{- end }} {{- $thumbnailPos = site.Params.hb.blog.post_thumbnail_position }} {{- end }}
+{{- $listStyle := site.Params.hb.blog.list_style }} +{{- if eq $listStyle "cascade" }} + {{ partialCached "hugomods/masonry-js/assets/js" . }} +{{- end }} +
{{ range .Pages }}
- {{- $ctx := dict "Page" . "ReadMore" $readMore "Modularize" $modularize "Caller" "list" }} + {{- $ctx := dict "Page" . "ReadMore" $readMore "Modularize" $modularize "Caller" "list" "ListStyle" $listStyle }} {{ partial "hb/modules/blog/post/card" $ctx }}
{{ end }}