fix: hide post navigation when no adjacent posts exist
All checks were successful
Deploy Theme / deploy (push) Successful in 14s

This commit is contained in:
2026-02-21 17:09:59 +01:00
parent 78c805bbf9
commit 4d2e5de954

View File

@@ -50,24 +50,38 @@
{{/if}} {{/if}}
{{!-- Next/Prev Navigation --}} {{!-- Next/Prev Navigation --}}
{{#next_post}}
<nav class="mt-16 grid grid-cols-1 md:grid-cols-2 gap-4 border-t border-[var(--bg-tertiary)] pt-12"> <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"> <div class="prev-post-nav">
{{#prev_post}} {{#../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"> <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> <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> <h4 class="text-xl font-bold group-hover:text-[var(--brand-primary)] transition-colors duration-300">{{title}}</h4>
</a> </a>
{{/prev_post}} {{/../prev_post}}
</div> </div>
<div class="next-post-nav md:text-right"> <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"> <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> <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> <h4 class="text-xl font-bold group-hover:text-[var(--brand-primary)] transition-colors duration-300">{{title}}</h4>
</a> </a>
{{/next_post}}
</div> </div>
</nav> </nav>
{{else}}
{{#prev_post}}
<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">
<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>
<div class="next-post-nav md:text-right">
{{!-- No next post --}}
</div>
</nav>
{{/prev_post}}
{{/next_post}}
{{/is}} {{/is}}
{{#is "post"}} {{#is "post"}}