{@post.title}
- <.post_meta post={@post} /> + <.post_meta post={@post} base_path={@base_path} />
{Phoenix.HTML.raw(@post.body)}
@@ -68,8 +70,16 @@ defmodule Blogex.Components do
@doc """
Renders post metadata (date, author, tags).
+
+ ## Attributes
+
+ * `:post` - a `%Blogex.Post{}` struct (required)
+ * `:base_path` - base URL path for tag links (required)
+ * `:current_tag` - currently selected tag for highlighting (optional)
"""
attr :post, :map, required: true
+ attr :base_path, :string, required: true
+ attr :current_tag, :string, default: nil
def post_meta(assigns) do
~H"""
@@ -80,9 +90,13 @@ defmodule Blogex.Components do
-
+
{tag}
-
+
"""
end
diff --git a/blogex/lib/blogex/layout.ex b/blogex/lib/blogex/layout.ex
index dba26c6..921fba4 100644
--- a/blogex/lib/blogex/layout.ex
+++ b/blogex/lib/blogex/layout.ex
@@ -64,7 +64,7 @@ defmodule Blogex.Layout do
- <.post_show post={@post} />
+ <.post_show post={@post} base_path={@base_path} />