refactor: extract partials for post components and create separate page template
All checks were successful
Deploy Theme / deploy (push) Successful in 13s
All checks were successful
Deploy Theme / deploy (push) Successful in 13s
This commit is contained in:
68
post.hbs
68
post.hbs
@@ -4,71 +4,27 @@
|
||||
<article class="container mx-auto px-4 py-12">
|
||||
<header class="text-center mb-8 max-w-3xl mx-auto">
|
||||
<h1 class="text-6xl font-bold tracking-tight text-[var(--text-primary)] mb-4">{{title fallback="No Title Provided"}}</h1>
|
||||
{{#is "post"}}
|
||||
<section class="post-meta text-[var(--text-secondary)] text-lg">
|
||||
<time datetime="{{date format="YYYY-MM-DD"}}">{{date format="MMMM DD, YYYY"}}</time>
|
||||
{{#if primary_tag}}
|
||||
<span class="mx-2">•</span>
|
||||
<a href="{{primary_tag.url}}" class="text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition duration-200">{{primary_tag.name}}</a>
|
||||
{{/if}}
|
||||
</section>
|
||||
{{/is}}
|
||||
<section class="post-meta text-[var(--text-secondary)] text-lg">
|
||||
<time datetime="{{date format="YYYY-MM-DD"}}">{{date format="MMMM DD, YYYY"}}</time>
|
||||
{{#if primary_tag}}
|
||||
<span class="mx-2">•</span>
|
||||
<a href="{{primary_tag.url}}" class="text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition duration-200">{{primary_tag.name}}</a>
|
||||
{{/if}}
|
||||
</section>
|
||||
</header>
|
||||
|
||||
{{#if feature_image}}
|
||||
<figure class="mb-12 rounded-lg overflow-hidden shadow-xl">
|
||||
<img
|
||||
class="w-full h-auto object-cover"
|
||||
src="{{img_url feature_image size="xl"}}"
|
||||
srcset="{{img_url feature_image size="l"}} 1000w,
|
||||
{{img_url feature_image size="xl"}} 2000w"
|
||||
sizes="(max-width: 1000px) 1000px, 2000px"
|
||||
alt="{{title fallback="No Title"}}"
|
||||
>
|
||||
</figure>
|
||||
{{> "feature-image"}}
|
||||
{{/if}}
|
||||
|
||||
<section class="post-content max-w-3xl mx-auto text-[var(--text-primary)] leading-relaxed text-lg prose">
|
||||
{{content fallback="<p>No content provided for this post.</p>"}}
|
||||
</section>
|
||||
|
||||
{{!-- Related Posts - Only show on posts, not pages --}}
|
||||
{{#is "post"}}
|
||||
{{!-- Next/Prev Navigation --}}
|
||||
<nav class="hidden has-[a]:grid mt-16 max-w-3xl mx-auto grid-cols-1 md:grid-cols-2 gap-4 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">← 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}}
|
||||
{{> "post-navigation"}}
|
||||
|
||||
{{#next_post}}
|
||||
<div class="next-post-nav 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 →</span>
|
||||
<h4 class="text-xl font-bold group-hover:text-[var(--brand-primary)] transition-colors duration-300">{{title}}</h4>
|
||||
</a>
|
||||
</div>
|
||||
{{/next_post}}
|
||||
</nav>
|
||||
|
||||
{{#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}}
|
||||
{{/is}}
|
||||
{{#if primary_tag}}
|
||||
{{> "related-posts"}}
|
||||
{{/if}}
|
||||
</article>
|
||||
{{/post}}
|
||||
|
||||
Reference in New Issue
Block a user