diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index bb020ed7..7ec92035 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -36,7 +36,7 @@ defaultBackgroundImage = "/img/iceland.jpg" showRecentItems = 10 showMoreLink = true showMoreLinkDest = "docs" - cardView = true + cardView = false cardViewScreenWidth = false layoutBackgroundBlur = true # only used when layout equals background diff --git a/exampleSite/layouts/partials/recent-articles-demo.html b/exampleSite/layouts/partials/recent-articles-demo.html index cf73aeed..2b91b85b 100644 --- a/exampleSite/layouts/partials/recent-articles-demo.html +++ b/exampleSite/layouts/partials/recent-articles-demo.html @@ -18,33 +18,15 @@
-
- {{ range first $recentArticles (.Paginate (where .Site.RegularPages "Type" "in" - .Site.Params.mainSections)).Pages }} - {{ partial "article-link-card.html" . }} - {{ end }} -
+ {{ partial "recent-articles-cardview-fullwidth.html" . }}
{{ if .Site.Params.homepage.showMoreLink | default false }} diff --git a/layouts/partials/recent-articles-cardview-fullwidth.html b/layouts/partials/recent-articles-cardview-fullwidth.html new file mode 100644 index 00000000..9542df83 --- /dev/null +++ b/layouts/partials/recent-articles-cardview-fullwidth.html @@ -0,0 +1,11 @@ +{{ $recentArticles := 5 }} +{{ $recentArticles = .Site.Params.homepage.showRecentItems }} + +
+ {{ range first $recentArticles (.Paginate (where .Site.RegularPages "Type" "in" + .Site.Params.mainSections)).Pages }} + {{ partial "article-link-card.html" . }} + {{ end }} +
\ No newline at end of file diff --git a/layouts/partials/recent-articles-cardview.html b/layouts/partials/recent-articles-cardview.html new file mode 100644 index 00000000..ff531a3f --- /dev/null +++ b/layouts/partials/recent-articles-cardview.html @@ -0,0 +1,9 @@ +{{ $recentArticles := 5 }} +{{ $recentArticles = .Site.Params.homepage.showRecentItems }} + +
+ {{ range first $recentArticles (.Paginate (where .Site.RegularPages "Type" "in" + .Site.Params.mainSections)).Pages }} + {{ partial "article-link-card.html" . }} + {{ end }} +
\ No newline at end of file diff --git a/layouts/partials/recent-articles-list.html b/layouts/partials/recent-articles-list.html new file mode 100644 index 00000000..f9515478 --- /dev/null +++ b/layouts/partials/recent-articles-list.html @@ -0,0 +1,9 @@ +{{ $recentArticles := 5 }} +{{ $recentArticles = .Site.Params.homepage.showRecentItems }} + +
+ {{ range first $recentArticles (.Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections)).Pages + }} + {{ partial "article-link.html" . }} + {{ end }} +
\ No newline at end of file diff --git a/layouts/partials/recent-articles.html b/layouts/partials/recent-articles.html index 72eace39..41744d49 100644 --- a/layouts/partials/recent-articles.html +++ b/layouts/partials/recent-articles.html @@ -6,25 +6,12 @@ {{ end }}

{{ i18n "shortcode.recent_articles" | emojify }}

-{{ if .Site.Params.homepage.cardView | default false }} -{{ if .Site.Params.homepage.cardViewScreenWidth | default false }} -
- {{ else }} -
- {{ end }} - {{ range first $recentArticles (.Paginate (where .Site.RegularPages "Type" "in" - .Site.Params.mainSections)).Pages }} - {{ partial "article-link-card.html" . }} - {{ end }} -
+{{ if and .Site.Params.homepage.cardView (not .Site.Params.homepage.cardViewScreenWidth) | default false }} + {{ partial "recent-articles-cardview.html" . }} +{{ else if and .Site.Params.homepage.cardView .Site.Params.homepage.cardViewScreenWidth | default false }} + {{ partial "recent-articles-cardview-fullwidth.html" . }} {{ else }} -
- {{ range first $recentArticles (.Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections)).Pages - }} - {{ partial "article-link.html" . }} - {{ end }} -
+ {{ partial "recent-articles-list.html" . }} {{ end }} {{ if .Site.Params.homepage.showMoreLink | default false }}