Plug-and-play blog engine for Phoenix with Editor.js integration.
Setup
- Add
{:phoenix_blog, "~> 0.1"}to yourmix.exs - Configure:
config :phoenix_blog, repo: MyApp.Repo - Create and run the migration (see
PhoenixBlog.Migration) - Mount routes in your router (see
PhoenixBlog.Web.Router)
Summary
Functions
Returns an %Ecto.Changeset{} for tracking post changes.
Returns the count of posts matching the given admin filters.
Returns the count of published posts matching the given filters.
Creates a post.
Deletes a post permanently.
Gets a single post by ID.
Gets a single published post by slug.
Gets a single post by slug (admin version, no status/deleted filters).
Returns the like count for a single post.
Returns a map of %{post_id => like_count} for a list of post IDs.
Efficient batch query for feed pages.
Returns true if the user has liked the post.
Returns a MapSet of post IDs that the given user has liked from the provided list.
Returns the latest N published posts.
Returns posts for admin with optional filters and pagination.
Returns published posts for public display with pagination.
Returns all unique tags from published posts, sorted alphabetically.
Publishes a post.
Restores a soft-deleted post.
Soft deletes a post.
Toggles a like for the given post by the given user.
Updates a post.
Functions
Returns an %Ecto.Changeset{} for tracking post changes.
Returns the count of posts matching the given admin filters.
Returns the count of published posts matching the given filters.
Creates a post.
Deletes a post permanently.
Gets a single post by ID.
Raises Ecto.NoResultsError if the post does not exist.
Gets a single published post by slug.
Raises Ecto.NoResultsError if the post does not exist.
Gets a single post by slug (admin version, no status/deleted filters).
Returns the like count for a single post.
Returns a map of %{post_id => like_count} for a list of post IDs.
Efficient batch query for feed pages.
Returns true if the user has liked the post.
Returns a MapSet of post IDs that the given user has liked from the provided list.
Returns the latest N published posts.
Returns posts for admin with optional filters and pagination.
Options
:page- Page number (default: 1):per_page- Items per page (default: 20):status- Filter by status:search- Search by title:tag- Filter by tag:show_deleted- Include soft-deleted posts (default: false)
Returns published posts for public display with pagination.
Options
:page- Page number (default: 1):per_page- Items per page (default: 12):search- Search by title:tag- Filter by tag
Returns all unique tags from published posts, sorted alphabetically.
Publishes a post.
Restores a soft-deleted post.
Soft deletes a post.
Toggles a like for the given post by the given user.
Returns {:ok, :liked} or {:ok, :unliked}.
Requires config :phoenix_blog, likes_enabled: true.
Updates a post.