fix: refactor post navigation to avoid nested helpers and hide empty container
All checks were successful
Deploy Theme / deploy (push) Successful in 14s

This commit is contained in:
2026-02-21 19:51:42 +01:00
parent 40cfb685b8
commit c872fa67e6

View File

@@ -50,35 +50,25 @@
{{/if}}
{{!-- Next/Prev Navigation --}}
{{#next_post}}
<nav class="mt-16 max-w-3xl mx-auto grid grid-cols-1 md:grid-cols-2 gap-4 border-t border-[var(--bg-tertiary)] pt-12">
{{#prev_post}}
<div class="prev-post-nav">
<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>
</div>
{{/prev_post}}
<div class="next-post-nav md:text-right">
<nav class="hidden has-[a]:grid mt-16 max-w-3xl mx-auto grid-cols-1 md:grid-cols-2 gap-4 border-t border-[var(--bg-tertiary)] pt-12">
{{#prev_post}}
<div class="prev-post-nav">
<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>
</div>
{{/prev_post}}
{{#next_post}}
<div class="next-post-nav md:text-right md:col-start-2">
<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>
</div>
</nav>
{{else}}
{{#prev_post}}
<nav class="mt-16 max-w-3xl mx-auto grid grid-cols-1 md:grid-cols-2 gap-4 border-t border-[var(--bg-tertiary)] pt-12">
<div class="prev-post-nav">
<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>
</div>
</nav>
{{/prev_post}}
{{/next_post}}
{{/next_post}}
</nav>
{{/is}}
</article>
{{/post}}