Show the recent posts section only when there are some

This commit is contained in:
Sodbileg Gansukh 2023-09-21 19:23:34 +08:00
parent 26d1610ef5
commit 701b60f2c9
2 changed files with 14 additions and 10 deletions

View File

@ -76,15 +76,6 @@
{{/foreach}} {{/foreach}}
{{/match}} {{/match}}
{{!-- Recent posts --}}
{{#match feed "recent"}}
{{#get "posts" include="authors" filter="id:-{{post.id}}" limit="4" as |next|}}
{{#foreach next}}
{{> "post-card" lazyLoad=true}}
{{/foreach}}
{{/get}}
{{/match}}
</div> </div>
</main> </main>

View File

@ -60,4 +60,17 @@
{{/post}} {{/post}}
{{> "components/post-list" feed="recent" postFeedStyle="Grid" title="Read more" showTitle=true showSidebar=false}} {{#get "posts" include="authors" filter="id:-{{post.id}}" limit="4" as |next|}}
{{#if next}}
<section class="gh-container is-grid gh-outer">
<div class="gh-container-inner gh-inner">
<h2 class="gh-container-title">Read more</h2>
<div class="gh-feed">
{{#foreach next}}
{{> "post-card" lazyLoad=true}}
{{/foreach}}
</div>
</div>
</section>
{{/if}}
{{/get}}