hugo-academic-mirror/layouts/partials/widgets/posts.html

59 lines
2.1 KiB
HTML

{{ $ := .root }}
{{ $page := .page }}
{{ $posts_len := len (where (where $.Data.Pages "Type" "post") ".Params.notonhomepage" nil) }}
{{ if gt $posts_len 0 }}
<!-- Blog Posts widget -->
<section id="posts" class="home-section">
<div class="container">
<div class="row">
<div class="col-xs-12 col-md-4 section-heading">
<h1>{{ with $page.Title }}{{ . | markdownify }}{{ end }}</h1>
{{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
{{ if gt $posts_len $page.Params.count }}
<p class="view-all">
<a href="{{ "/post/" | relURL }}">
{{ with $page.Params.str_all }}{{ . | markdownify }}{{ end }}
<i class="fa fa-angle-double-right"></i>
</a>
</p>
{{ end }}
</div>
<div class="col-xs-12 col-md-8">
{{ with $page.Content }}<p>{{ . | markdownify }}</p>{{ end }}
{{ range first $page.Params.count (where (where $.Data.Pages "Type" "post") ".Params.notonhomepage" nil) }}
<div class="article-list-item" itemscope itemprop="blogPost">
{{ if .Params.image }}
<a href="{{ .Permalink }}">
<img src="{{ "/img/" | relURL }}{{ .Params.image }}" class="article-banner"
itemprop="image">
</a>
{{end}}
<h3 class="article-title" itemprop="name">
<a href="{{ .Permalink }}" itemprop="url">{{.Title }}</a>
</h3>
{{ partial "article_metadata" (dict "content" . "is_list" 1) }}
<p class="article-style" itemprop="articleBody">
{{ if .Params.summary }}
{{ printf "%s" .Params.summary | markdownify }}
{{ else if .Truncated }}
{{ printf "%s" .Summary | markdownify }}
{{ else }}
{{ .Content }}
{{ end }}
</p>
<p class="read-more">
<a href="{{ .Permalink }}" class="btn btn-primary btn-outline">
{{ with $page.Params.str_read_more }}{{ . | markdownify }}{{ end }}
</a>
</p>
</div>
{{ end }}
</div>
</div>
</div>
</section>
{{ end }}