From 269d314758094f8bf6e30b0befee912ba89f933f Mon Sep 17 00:00:00 2001 From: Dreytac Date: Mon, 20 Apr 2026 09:17:00 +1000 Subject: [PATCH] Create a snippet for displaying a card style "post". --- index.php | 1 + snippets/collection/post.php | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 snippets/collection/post.php diff --git a/index.php b/index.php index ed53b9e..c3715be 100644 --- a/index.php +++ b/index.php @@ -30,6 +30,7 @@ Kirby::plugin( ], "snippets" => [ "navbar/primary" => __DIR__ . "/snippets/navbar/primary.php", + "collection/post" => __DIR__ . "/snippets/collection/post.php", ], "hooks" => [ /** diff --git a/snippets/collection/post.php b/snippets/collection/post.php new file mode 100644 index 0000000..836c047 --- /dev/null +++ b/snippets/collection/post.php @@ -0,0 +1,34 @@ +
isDraft(), " text-secondary") ?>"> +
+

+ title() ?> + pinned()->isTrue() || $post->isDraft()) : ?> +
+ pinned()->isTrue(), kirbytag("fa", "thumbtack", ["class" => "fa-xs"])) ?> + isDraft(), kirbytag("fa", "pencil-ruler", ["class" => "fa-xs"])) ?> +
+ +

+ + + created()->toDate("Y-m-d")), date_create($post->updated()->toDate("Y-m-d")))->format("%a") > 0) : ?> + Updated on updated()->toDate('l \t\h\e jS \of F Y') ?> + + Posted on created()->toDate('l \t\h\e jS \of F Y') ?> + + +
+ + text()->textExcerpt(600, false) ?> +
+ +