Router macros for mounting PhoenixBlog in your application.
Usage
# In your router.ex
use PhoenixBlog.Web, :router
scope "/" do
pipe_through :browser
phoenix_blog "/blog"
end
scope "/" do
pipe_through [:browser, :require_authenticated_user]
phoenix_blog_dashboard "/blog/admin",
on_mount: [{MyAppWeb.UserAuth, :require_authenticated}]
end
Summary
Functions
Mounts the public blog routes at the given path.
Mounts the admin blog dashboard routes at the given path.
Functions
Mounts the public blog routes at the given path.
Options
:on_mount- Additional on_mount hooks (default: []):as- Live session name (default: :phoenix_blog):layout- Override the app layout module:root_layout- Override the root layout (default: uses your app's root layout):index_view- Custom LiveView module for the blog index (default:PhoenixBlog.Web.Live.Public.Index):show_view- Custom LiveView module for the blog post page (default:PhoenixBlog.Web.Live.Public.Show)
Examples
# Default
phoenix_blog "/blog"
# Custom views
phoenix_blog "/blog",
index_view: MyAppWeb.CustomBlogIndex,
show_view: MyAppWeb.CustomBlogShow
Mounts the admin blog dashboard routes at the given path.
Accepts on_mount option for authentication hooks.
Accepts layout option to wrap blog pages in your app layout.
Routes:
GET <path>- Admin post indexGET <path>/new- New post formGET <path>/:id/edit- Edit post form