From f431b97559d7100be66d9da3bcde11f38f8ea457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Sat, 21 Feb 2026 20:38:28 +0100 Subject: [PATCH] refactor: extract partials for post components and create separate page template --- page.hbs | 17 +++++++++ partials/feature-image.hbs | 10 ++++++ partials/post-navigation.hbs | 19 ++++++++++ partials/related-posts.hbs | 12 +++++++ post.hbs | 68 +++++++----------------------------- 5 files changed, 70 insertions(+), 56 deletions(-) create mode 100644 page.hbs create mode 100644 partials/feature-image.hbs create mode 100644 partials/post-navigation.hbs create mode 100644 partials/related-posts.hbs diff --git a/page.hbs b/page.hbs new file mode 100644 index 0000000..4166ea7 --- /dev/null +++ b/page.hbs @@ -0,0 +1,17 @@ +{{!< default}} + +{{#post}} +
+
+

{{title}}

+
+ + {{#if feature_image}} + {{> "feature-image"}} + {{/if}} + +
+ {{content}} +
+
+{{/post}} diff --git a/partials/feature-image.hbs b/partials/feature-image.hbs new file mode 100644 index 0000000..1bad3ae --- /dev/null +++ b/partials/feature-image.hbs @@ -0,0 +1,10 @@ +
+ {{title fallback= +
diff --git a/partials/post-navigation.hbs b/partials/post-navigation.hbs new file mode 100644 index 0000000..1b8c4bc --- /dev/null +++ b/partials/post-navigation.hbs @@ -0,0 +1,19 @@ + diff --git a/partials/related-posts.hbs b/partials/related-posts.hbs new file mode 100644 index 0000000..aa73af6 --- /dev/null +++ b/partials/related-posts.hbs @@ -0,0 +1,12 @@ +{{#get "posts" filter="tags:{{primary_tag.slug}}+id:-{{id}}" limit="3" as |related_posts|}} + {{#if related_posts}} +
+

You might also like

+
+ {{#foreach related_posts}} + {{> "post-card"}} + {{/foreach}} +
+
+ {{/if}} +{{/get}} diff --git a/post.hbs b/post.hbs index b528a78..f19a90b 100644 --- a/post.hbs +++ b/post.hbs @@ -4,71 +4,27 @@

{{title fallback="No Title Provided"}}

- {{#is "post"}} - - {{/is}} +
{{#if feature_image}} -
- {{title fallback= -
+ {{> "feature-image"}} {{/if}}
{{content fallback="

No content provided for this post.

"}}
- {{!-- Related Posts - Only show on posts, not pages --}} - {{#is "post"}} - {{!-- Next/Prev Navigation --}} - - - {{#if primary_tag}} - {{#get "posts" filter="tags:{{primary_tag.slug}}+id:-{{id}}" limit="3" as |related_posts|}} - {{#if related_posts}} -
-

You might also like

-
- {{#foreach related_posts}} - {{> "post-card"}} - {{/foreach}} -
-
- {{/if}} - {{/get}} - {{/if}} - {{/is}} + {{#if primary_tag}} + {{> "related-posts"}} + {{/if}}
{{/post}}