mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-01-23 06:55:43 -06:00
Merge pull request #348 from nunocoracao/347-refactor-custom-landing-page
♻️ Refactor custom landing page and recent articles
This commit is contained in:
commit
f6cd5fce31
6 changed files with 38 additions and 40 deletions
|
@ -36,7 +36,7 @@ defaultBackgroundImage = "/img/iceland.jpg"
|
||||||
showRecentItems = 10
|
showRecentItems = 10
|
||||||
showMoreLink = true
|
showMoreLink = true
|
||||||
showMoreLinkDest = "docs"
|
showMoreLinkDest = "docs"
|
||||||
cardView = true
|
cardView = false
|
||||||
cardViewScreenWidth = false
|
cardViewScreenWidth = false
|
||||||
layoutBackgroundBlur = true # only used when layout equals background
|
layoutBackgroundBlur = true # only used when layout equals background
|
||||||
|
|
||||||
|
|
|
@ -18,33 +18,15 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="CardViewScreenWidth" class="">
|
<div id="CardViewScreenWidth" class="">
|
||||||
<section
|
{{ partial "recent-articles-cardview-fullwidth.html" . }}
|
||||||
class="relative w-screen max-w-[1600px] grid gap-4 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5"
|
|
||||||
style="left: calc(max(-50vw,-800px) + 50%);">
|
|
||||||
{{ range first $recentArticles (.Paginate (where .Site.RegularPages "Type" "in"
|
|
||||||
.Site.Params.mainSections)).Pages }}
|
|
||||||
{{ partial "article-link-card.html" . }}
|
|
||||||
{{ end }}
|
|
||||||
</section>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="CardViewProse" class="hidden h-full">
|
<div id="CardViewProse" class="hidden h-full">
|
||||||
<section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3">
|
{{ partial "recent-articles-cardview.html" . }}
|
||||||
{{ range first $recentArticles (.Paginate (where .Site.RegularPages "Type" "in"
|
|
||||||
.Site.Params.mainSections)).Pages }}
|
|
||||||
{{ partial "article-link-card.html" . }}
|
|
||||||
{{ end }}
|
|
||||||
</section>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="NormalView" class="hidden h-full">
|
<div id="NormalView" class="hidden h-full">
|
||||||
<section class="space-y-10 w-full">
|
{{ partial "recent-articles-list.html" . }}
|
||||||
{{ range first $recentArticles (.Paginate (where .Site.RegularPages "Type" "in"
|
|
||||||
.Site.Params.mainSections)).Pages
|
|
||||||
}}
|
|
||||||
{{ partial "article-link.html" . }}
|
|
||||||
{{ end }}
|
|
||||||
</section>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ if .Site.Params.homepage.showMoreLink | default false }}
|
{{ if .Site.Params.homepage.showMoreLink | default false }}
|
||||||
|
|
11
layouts/partials/recent-articles-cardview-fullwidth.html
Normal file
11
layouts/partials/recent-articles-cardview-fullwidth.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{{ $recentArticles := 5 }}
|
||||||
|
{{ $recentArticles = .Site.Params.homepage.showRecentItems }}
|
||||||
|
|
||||||
|
<section
|
||||||
|
class="relative w-screen max-w-[1600px] grid gap-4 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5"
|
||||||
|
style="left: calc(max(-50vw,-800px) + 50%);">
|
||||||
|
{{ range first $recentArticles (.Paginate (where .Site.RegularPages "Type" "in"
|
||||||
|
.Site.Params.mainSections)).Pages }}
|
||||||
|
{{ partial "article-link-card.html" . }}
|
||||||
|
{{ end }}
|
||||||
|
</section>
|
9
layouts/partials/recent-articles-cardview.html
Normal file
9
layouts/partials/recent-articles-cardview.html
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{{ $recentArticles := 5 }}
|
||||||
|
{{ $recentArticles = .Site.Params.homepage.showRecentItems }}
|
||||||
|
|
||||||
|
<section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3">
|
||||||
|
{{ range first $recentArticles (.Paginate (where .Site.RegularPages "Type" "in"
|
||||||
|
.Site.Params.mainSections)).Pages }}
|
||||||
|
{{ partial "article-link-card.html" . }}
|
||||||
|
{{ end }}
|
||||||
|
</section>
|
9
layouts/partials/recent-articles-list.html
Normal file
9
layouts/partials/recent-articles-list.html
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{{ $recentArticles := 5 }}
|
||||||
|
{{ $recentArticles = .Site.Params.homepage.showRecentItems }}
|
||||||
|
|
||||||
|
<section class="space-y-10 w-full">
|
||||||
|
{{ range first $recentArticles (.Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections)).Pages
|
||||||
|
}}
|
||||||
|
{{ partial "article-link.html" . }}
|
||||||
|
{{ end }}
|
||||||
|
</section>
|
|
@ -6,25 +6,12 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<h2 class="mt-8 text-2xl font-extrabold mb-10">{{ i18n "shortcode.recent_articles" | emojify }}</h2>
|
<h2 class="mt-8 text-2xl font-extrabold mb-10">{{ i18n "shortcode.recent_articles" | emojify }}</h2>
|
||||||
|
|
||||||
{{ if .Site.Params.homepage.cardView | default false }}
|
{{ if and .Site.Params.homepage.cardView (not .Site.Params.homepage.cardViewScreenWidth) | default false }}
|
||||||
{{ if .Site.Params.homepage.cardViewScreenWidth | default false }}
|
{{ partial "recent-articles-cardview.html" . }}
|
||||||
<section class="relative w-screen max-w-[1600px] grid gap-4 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5"
|
{{ else if and .Site.Params.homepage.cardView .Site.Params.homepage.cardViewScreenWidth | default false }}
|
||||||
style="left: calc(max(-50vw,-800px) + 50%);">
|
{{ partial "recent-articles-cardview-fullwidth.html" . }}
|
||||||
{{ else }}
|
|
||||||
<section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3">
|
|
||||||
{{ end }}
|
|
||||||
{{ range first $recentArticles (.Paginate (where .Site.RegularPages "Type" "in"
|
|
||||||
.Site.Params.mainSections)).Pages }}
|
|
||||||
{{ partial "article-link-card.html" . }}
|
|
||||||
{{ end }}
|
|
||||||
</section>
|
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<section class="space-y-10 w-full">
|
{{ partial "recent-articles-list.html" . }}
|
||||||
{{ range first $recentArticles (.Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections)).Pages
|
|
||||||
}}
|
|
||||||
{{ partial "article-link.html" . }}
|
|
||||||
{{ end }}
|
|
||||||
</section>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if .Site.Params.homepage.showMoreLink | default false }}
|
{{ if .Site.Params.homepage.showMoreLink | default false }}
|
||||||
|
|
Loading…
Reference in a new issue