Allow direct access to draft and scheduled posts by slug
This commit is contained in:
@@ -105,13 +105,13 @@ defmodule Blogex.Blog do
|
||||
|
||||
@doc "Returns a single post by slug/id, or raises."
|
||||
def get_post!(id) do
|
||||
Enum.find(all_posts(), &(&1.id == id)) ||
|
||||
Enum.find(unfiltered_posts(), &(&1.id == id)) ||
|
||||
raise Blogex.NotFoundError, "post #{inspect(id)} not found in #{@blog_id}"
|
||||
end
|
||||
|
||||
@doc "Returns a single post by slug/id, or nil."
|
||||
def get_post(id) do
|
||||
Enum.find(all_posts(), &(&1.id == id))
|
||||
Enum.find(unfiltered_posts(), &(&1.id == id))
|
||||
end
|
||||
|
||||
@doc "Returns paginated posts. Page is 1-indexed."
|
||||
|
||||
Reference in New Issue
Block a user