JOL/lib/jol_web/controllers/blog_controller.ex

15 lines
366 B
Elixir
Raw Normal View History

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())
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)
end
end