feat: add related posts and next/previous navigation to post template
All checks were successful
Deploy Theme / deploy (push) Successful in 13s

This commit is contained in:
2026-02-20 09:58:02 +01:00
parent fa7c5bb487
commit 056c68dbc0

View File

@@ -30,6 +30,42 @@
{{content fallback="<p>No content provided for this post.</p>"}} {{content fallback="<p>No content provided for this post.</p>"}}
</section> </section>
{{!-- Related Posts --}}
{{#if primary_tag}}
{{#get "posts" filter="tags:{{primary_tag.slug}}+id:-{{id}}" limit="3" as |related_posts|}}
{{#if related_posts}}
<section class="mt-16 pt-12 border-t border-[var(--bg-tertiary)]">
<h3 class="text-3xl font-bold mb-8 text-center">You might also like</h3>
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8">
{{#foreach related_posts}}
{{> "post-card"}}
{{/foreach}}
</div>
</section>
{{/if}}
{{/get}}
{{/if}}
{{!-- Next/Prev Navigation --}}
<nav class="mt-16 grid grid-cols-1 md:grid-cols-2 gap-4 border-t border-[var(--bg-tertiary)] pt-12">
<div class="prev-post-nav">
{{#prev_post}}
<a href="{{url}}" class="group block p-6 bg-[var(--bg-secondary)] rounded-lg hover:bg-[var(--bg-tertiary)] transition-all duration-300">
<span class="text-xs uppercase tracking-widest text-[var(--text-tertiary)] mb-2 block">&larr; Previous Post</span>
<h4 class="text-xl font-bold group-hover:text-[var(--brand-primary)] transition-colors duration-300">{{title}}</h4>
</a>
{{/prev_post}}
</div>
<div class="next-post-nav md:text-right">
{{#next_post}}
<a href="{{url}}" class="group block p-6 bg-[var(--bg-secondary)] rounded-lg hover:bg-[var(--bg-tertiary)] transition-all duration-300">
<span class="text-xs uppercase tracking-widest text-[var(--text-tertiary)] mb-2 block">Next Post &rarr;</span>
<h4 class="text-xl font-bold group-hover:text-[var(--brand-primary)] transition-colors duration-300">{{title}}</h4>
</a>
{{/next_post}}
</div>
</nav>
<footer class="mt-12 pt-8 border-t border-[var(--bg-tertiary)] text-center"> <footer class="mt-12 pt-8 border-t border-[var(--bg-tertiary)] text-center">
<a href="/" class="btn-primary"> <a href="/" class="btn-primary">
&larr; Back to Home &larr; Back to Home