ghost-theme-sd.ai/partials/components/post-list.hbs

96 lines
3.9 KiB
Handlebars

{{!--
Parameters:
* feed (index, home, archive, recent)
* postFeedStyle (list, grid)
* showTitle (true, false)
* showSidebar (true, false)
--}}
<section class="gh-container is-{{#match postFeedStyle "List"}}list{{else}}grid{{/match}}{{#if showSidebar}} has-sidebar{{/if}}{{#unless @custom.show_images_in_feed}} no-image{{/unless}} gh-outer">
<div class="gh-container-inner gh-inner">
{{#if showTitle}}
<h2 class="gh-container-title">
{{#unless title}}Latest{{else}}{{title}}{{/unless}}
</h2>
{{/if}}
<main class="gh-main">
<div class="gh-feed">
{{!-- Homepage --}}
{{#match feed "home"}}
{{#match @custom.header_style "Highlight"}}
{{#if @custom.show_featured_posts}}
{{#match posts.length ">=" 4}}
{{#get "posts" include="authors,tags" limit="16"}}
{{#foreach posts from="5" limit="12"}}
{{> "post-card" lazyLoad=true}}
{{/foreach}}
{{/get}}
{{/match}}
{{else}}
{{#match posts.length ">=" 10}}
{{#get "posts" include="authors,tags" limit="22"}}
{{#foreach posts from="11" limit="12"}}
{{> "post-card" lazyLoad=true}}
{{/foreach}}
{{/get}}
{{/match}}
{{/if}}
{{else match @custom.header_style "Magazine"}}
{{#match posts.length ">=" 7}}
{{#get "posts" include="authors,tags" limit="19"}}
{{#foreach posts from="8" limit="12"}}
{{> "post-card" lazyLoad=true}}
{{/foreach}}
{{/get}}
{{/match}}
{{else}}
{{#get "posts" include="authors,tags" limit="12"}}
{{#foreach posts}}
{{> "post-card" lazyLoad=true}}
{{/foreach}}
{{/get}}
{{/match}}
{{/match}}
{{!-- All posts --}}
{{#match feed "index"}}
{{#match pagination.page 2}}
{{#get "posts" include="authors,tags" limit=@config.posts_per_page as |recent|}}
{{#foreach recent}}
{{> "post-card"}}
{{/foreach}}
{{/get}}
{{/match}}
{{#foreach posts}}
{{> "post-card" lazyLoad=true}}
{{/foreach}}
{{/match}}
{{!-- Tag and author pages --}}
{{#match feed "archive"}}
{{#foreach posts}}
{{> "post-card" lazyLoad=true}}
{{/foreach}}
{{/match}}
</div>
</main>
{{#if showSidebar}}
<aside class="gh-sidebar">
<h3 class="gh-card-title is-title"><a href="https://social.sd.ai/@s" target="_blank" rel="noopener">Latest From Mastodon</a></h3>
<div id="mastodon-comments-list"></div>
</aside>
{{/if}}
{{#match pagination.pages ">" 1}}
<div class="gh-more is-title">
<a href="/page/2">See all {{> "icons/arrow"}}</a>
</div>
{{/match}}
</div>
</section>