2024-06-04 18:09:14 +00:00
|
|
|
defmodule JOLWeb.BlogController do
|
|
|
|
use JOLWeb, :controller
|
|
|
|
|
|
|
|
alias JOL.Blog
|
|
|
|
|
|
|
|
def index(conn, _params) do
|
2024-08-25 19:56:46 +00:00
|
|
|
render(conn, "index.html", page_title: "You Asked For Posts", posts: Blog.recent_posts())
|
2024-06-04 18:09:14 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def show(conn, %{"slug" => slug}) do
|
2024-08-25 19:56:46 +00:00
|
|
|
post = Blog.get_post_by_slug!(slug)
|
|
|
|
render(conn, "show.html", page_title: post.title, post: post)
|
2024-06-04 18:09:14 +00:00
|
|
|
end
|
|
|
|
end
|