Add option to use 1st entry as some Information

Currenty supports 2 vals Title and Content
Great for short intro for bloggers

can be enabled by using `Params.homeInfoParams`
    homeInfoParams:
      enabled: true
      Title: Hi there 👋
      Content: This is Content !! Can be Info, links, social-icons...
This commit is contained in:
Aditya Telange 2020-07-23 16:24:44 +05:30
parent fe986eb333
commit 8356e48e47
2 changed files with 15 additions and 1 deletions

View File

@ -8,10 +8,14 @@
{{ end }} {{ end }}
{{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }} {{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }}
{{- if (and $.IsHome (eq $.Site.Params.homeInfoParams.enabled true)) }}
{{- partial "homeInfo.html" . }}
{{ end }}
{{- range $index, $page := $paginator.Pages }} {{- range $index, $page := $paginator.Pages }}
{{- $class := "post-entry" }} {{- $class := "post-entry" }}
{{- if (and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0)) }} {{- if (and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0) (ne $.Site.Params.homeInfoParams.enabled true)) }}
{{- $class = "first-entry" }} {{- $class = "first-entry" }}
{{- else if .Data.Term }} {{- else if .Data.Term }}
{{- $class = "post-entry tag-entry" }} {{- $class = "post-entry tag-entry" }}

View File

@ -0,0 +1,10 @@
{{ with $.Site.Params.homeInfoParams }}
<article class="first-entry">
<header class="entry-header">
<h2>{{ .Title }}</h2>
</header>
<section class="entry-content">
<p>{{ .Content | plainify | htmlUnescape }}...</p>
</section>
</article>
{{end}}