Files
HugoBlox-kit/layouts/partials/widgets/posts.html
T
George Cushen 1584b2db62 refactor: consolidate and simplify compact views
- Consolidate the code for all compact views into a single file
- Make authors clickable in all compact views
- Improve archetypes

BREAKING CHANGES:
`abstract_short` field dropped in publications and talks in favour of
`summary` field.

See #918
See https://github.com/gcushen/hugo-academic/issues/916#issuecomment-462274214
2019-02-11 13:59:18 +00:00

49 lines
1.5 KiB
HTML

{{ $ := .root }}
{{ $page := .page }}
{{ $query := where (where $.Site.RegularPages "Type" "post") ".Params.notonhomepage" nil }}
{{ $archive_page := $.Site.GetPage "section" "post" }}
{{/* Check if a filter should be applied. */}}
{{ if $page.Params.filter_tag }}
{{ $archive_page = $.Site.GetPage (printf "tags/%s" $page.Params.filter_tag) }}
{{ $query = $query | intersect $archive_page.Pages }}
{{ else if $page.Params.filter_category }}
{{ $archive_page = $.Site.GetPage (printf "categories/%s" $page.Params.filter_category) }}
{{ $query = $query | intersect $archive_page.Pages }}
{{ end }}
{{ $count := len $query }}
<!-- Blog Posts widget -->
<div class="row">
<div class="col-12 col-lg-4 section-heading">
<h1>{{ with $page.Title }}{{ . | markdownify }}{{ end }}</h1>
{{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
</div>
<div class="col-12 col-lg-8">
{{ with $page.Content }}<p>{{ . | markdownify }}</p>{{ end }}
{{ range $post := first $page.Params.count $query }}
{{ if eq $page.Params.view 1 }}
{{ partial "li_list" . }}
{{ else if eq $page.Params.view 3 }}
{{ partial "post_li_card" . }}
{{ else }}
{{ partial "li_compact" . }}
{{ end }}
{{end}}
{{ if gt $count $page.Params.count }}
<div class="see-all">
<a href="{{ $archive_page.RelPermalink }}">
{{ i18n "more_posts" | markdownify }}
<i class="fas fa-angle-right"></i>
</a>
</div>
{{ end }}
</div>
</div>