diff --git a/implementations/Catcrafts-Blog.cpp b/implementations/Catcrafts-Blog.cpp
index 2b58919..7cf52b1 100644
--- a/implementations/Catcrafts-Blog.cpp
+++ b/implementations/Catcrafts-Blog.cpp
@@ -34,7 +34,7 @@ export namespace Catcrafts {
}
}
html += std::format(R"(
-
+
-
)", post.name, post.date, previewContent, post.slug);
+
)", post.slug, post.name, post.date, previewContent);
}
main->SetInnerHTML(html);
for(const BlogPost& post : *posts) {
- HtmlElementView& view = blogButtons->emplace_back(std::format("blog-button-{}", post.slug));
- view.AddClickListener([slug = post.slug](Crafter::MouseEvent e) {
+ // Add click listener to the entire post card
+ HtmlElementView& cardView = blogButtons->emplace_back(std::format("blog-post-{}", post.slug));
+ cardView.AddClickListener([slug = post.slug](Crafter::MouseEvent e) {
PushState("{}", "", std::format("/blog/{}", slug));
RenderRoot(std::format("/blog/{}", slug));
});
+
}
}
diff --git a/styles/styles.css b/styles/styles.css
index b66c01a..f859fe6 100644
--- a/styles/styles.css
+++ b/styles/styles.css
@@ -166,6 +166,9 @@ main {
opacity: 0;
transform: translateY(20px);
animation-fill-mode: forwards;
+ position: relative;
+ overflow: hidden;
+ cursor: pointer;
}
.post:nth-child(1) { animation-delay: 0.1s; }
@@ -241,6 +244,11 @@ main {
margin-bottom: 0.5rem;
}
+/* Make entire blog post card clickable */
+.post:hover {
+ cursor: pointer;
+}
+
/* Footer */
footer {
background-color: var(--dark-color);