PhoenixBlog.Web.Components.BlogPost (phoenix_blog v0.1.7)

Copy Markdown View Source

A function component for rendering a single blog post.

Import and use it in any template:

import PhoenixBlog.Web.Components.BlogPost

<.blog_post post={@post} blog_path="/blog" />

Attributes

  • post (required) - A %PhoenixBlog.Post{} struct
  • blog_path - Path to blog index for back/tag links (default: "/blog")
  • show_back_link - Show "Back to blog" link (default: true)
  • show_header - Show post header with title, tags, author, date (default: true)
  • show_featured_image - Show featured image (default: true)
  • show_tags_footer - Show tags section at bottom (default: true)
  • class - CSS classes for the wrapper article element

Summary

Functions

blog_post(assigns)

Attributes

  • post (:map) (required)
  • blog_path (:string) - Defaults to "/blog".
  • show_back_link (:boolean) - Defaults to true.
  • show_header (:boolean) - Defaults to true.
  • show_featured_image (:boolean) - Defaults to true.
  • show_tags_footer (:boolean) - Defaults to true.
  • like_count (:integer) - Defaults to nil.
  • liked (:boolean) - Defaults to false.
  • current_user (:any) - Defaults to nil.
  • class (:string) - Defaults to nil.

Slots

  • inner_block