ghost-theme-sd.ai/partials/components/post-list.hbs
2023-09-04 19:44:58 +08:00

117 lines
4.6 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">
{{#match feed "home"}}
{{#match @custom.header_style "Highlight"}}
{{#match posts.length ">=" 10}}
{{#if @custom.highlight_featured_posts}}
{{#foreach posts from="5" limit="8"}}
{{> "post-card"}}
{{/foreach}}
{{else}}
{{#foreach posts from="11" limit="8"}}
{{> "post-card"}}
{{/foreach}}
{{/if}}
{{else}}
{{#foreach posts limit="8"}}
{{> "post-card"}}
{{/foreach}}
{{/match}}
{{else match @custom.header_style "Magazine"}}
{{#match posts.length ">=" 7}}
{{#foreach posts from="8" limit="8"}}
{{> "post-card"}}
{{/foreach}}
{{else}}
{{#foreach posts limit="8"}}
{{> "post-card"}}
{{/foreach}}
{{/match}}
{{else}}
{{#foreach posts limit="8"}}
{{> "post-card"}}
{{/foreach}}
{{/match}}
{{/match}}
{{#match feed "index"}}
{{#match pagination.page 2}}
{{#get "posts" include="authors" limit=@config.posts_per_page as |recent|}}
{{#foreach recent}}
{{> "post-card"}}
{{/foreach}}
{{/get}}
{{/match}}
{{#foreach posts}}
{{> "post-card"}}
{{/foreach}}
{{/match}}
{{#match feed "archive"}}
{{#foreach posts}}
{{> "post-card"}}
{{/foreach}}
{{/match}}
{{#match feed "recent"}}
{{#get "posts" include="authors" filter="id:-{{post.id}}" limit="4" as |next|}}
{{#foreach next}}
{{> "post-card"}}
{{/foreach}}
{{/get}}
{{/match}}
</div>
</main>
{{#if showSidebar}}
<aside class="gh-sidebar">
<section class="gh-about">
{{#if @site.icon}}
<img class="gh-about-icon" src="{{@site.icon}}" alt="{{@site.title}}">
{{/if}}
<h3 class="gh-about-title is-title">{{@site.title}}</h3>
{{#if @site.description}}
<p class="gh-about-description is-body">{{@site.description}}</p>
{{/if}}
{{#if @site.members_enabled}}
{{#unless @member}}
<button class="gh-button" data-portal="signup">Subscribe</button>
{{else}}
{{#if @site.paid_members_enabled}}
{{#unless @member.paid}}
<button class="gh-button" data-portal="upgrade">Upgrade</button>
{{/unless}}
{{/if}}
{{/unless}}
{{/if}}
</section>
</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>