list blog posts on home page
psalphabeta opened this issue · 1 comments
psalphabeta commented
psalphabeta commented
Added the below code in layouts/index.html and it worked
{{ define "main" }}
{{ with .Params.banner }}
<section class="section pt-14">
<div class="container">
<div class="row justify-center">
<div class="lg:col-7 md:col-9 mb-8 text-center">
<h1 class="mb-4 text-h3 lg:text-h1">
{{ .title | markdownify }}
</h1>
<p class="mb-8">
{{ .content | markdownify }}
</p>
{{ with .button }}
{{ if .enable }}
<a
class="btn btn-primary"
href="{{ .link | absURL }}"
{{ if strings.HasPrefix .link `http` }}
target="_blank" rel="noopener"
{{ end }}>
{{ .label }}
<i class="fa fa-arrow-right pl-2"></i>
</a>
{{ end }}
{{ end }}
</div>
<div class="col-12">
{{ partial "image" (dict "Src" .image "Alt" "Banner image" "Loading" "eager" "Class" "mx-auto lg:!max-w-[800px]" "DisplayXL" "800x" ) }}
</div>
</div>
</div>
</section>
{{ end }}
<section class="section">
<div class="container">
<div class="row gx-5">
<div class="lg:col-8">
<div class="row">
{{ $frontBundle := .Site.Params.frontBundle | default "blog" }}
{{ range first 2 (where .Site.RegularPages.ByDate.Reverse "Type" $frontBundle) }}
<div class="md:col-6 mb-14">
{{ partial "components/blog-card" . }}
</div>
{{ end }}
<div class="text-center mb-8">
<a href="/blog" class="btn btn-primary">
More Posts
</a>
</div>
</div>
</div>
<div class="lg:col-4">
{{ $widget:= site.Params.widgets.sidebar }}
{{ partialCached "widgets/widget-wrapper" ( dict "Widgets" $widget "Scope" . ) }}
</div>
</div>
</div>
</section>
{{ end }}