diff --git a/apps/content/lib/content/sitemap.ex b/apps/content/lib/content/sitemap.ex index 4705b550..e2eeda00 100644 --- a/apps/content/lib/content/sitemap.ex +++ b/apps/content/lib/content/sitemap.ex @@ -36,7 +36,7 @@ defmodule Legendary.Content.Sitemaps do if page_count > 1 do (2..page_count) |> Enum.each(fn page -> - add Helpers.paged_post_path(Endpoint, :show, post, page), priority: 0.5, changefreq: "hourly", expires: nil + add Helpers.posts_path(Endpoint, :show, post, page: page), priority: 0.5, changefreq: "hourly", expires: nil end) end end diff --git a/apps/content/lib/content_web/controllers/posts_controller.ex b/apps/content/lib/content_web/controllers/posts_controller.ex index 907d9407..a1eb7444 100644 --- a/apps/content/lib/content_web/controllers/posts_controller.ex +++ b/apps/content/lib/content_web/controllers/posts_controller.ex @@ -68,7 +68,7 @@ defmodule Legendary.Content.PostsController do end end def show(conn, %{"id" => id, "page" => page_string}) when is_list(id) do - show(conn, %{"id" => Enum.join(id, "/"), "page" => "1"}) + show(conn, %{"id" => Enum.join(id, "/"), "page" => page_string}) end def show(conn, %{"id" => id}), do: show(conn, %{"id" => id, "page" => "1"}) diff --git a/apps/content/lib/content_web/routes.ex b/apps/content/lib/content_web/routes.ex index 2462af43..a4b3244b 100644 --- a/apps/content/lib/content_web/routes.ex +++ b/apps/content/lib/content_web/routes.ex @@ -32,8 +32,8 @@ defmodule Legendary.Content.Routes do post "/wp-login.php", PostPasswordController, :create get "/", PostsController, :index resources "/sitemap", SitemapController, only: [:index] - get "/*id", PostsController, :show - get "/:id/:page", PostsController, :show, as: :paged_post + get "/:id", PostsController, :show + get "/*id", PostsController, :show, as: :nested_posts end end end diff --git a/apps/content/lib/content_web/templates/posts/pagination.html.eex b/apps/content/lib/content_web/templates/posts/pagination.html.eex index f6a553ed..4b26928b 100644 --- a/apps/content/lib/content_web/templates/posts/pagination.html.eex +++ b/apps/content/lib/content_web/templates/posts/pagination.html.eex @@ -5,7 +5,7 @@ 1..Legendary.Content.Post.content_page_count(@post), fn page -> if assigns[:current_page] == nil || assigns[:current_page] != page do - link page, to: Routes.paged_post_path(@conn, :show, @post, page) + link page, to: Routes.posts_path(@conn, :show, @post, page: page) else content_tag :span, page, class: "paginator-page" end diff --git a/apps/content/test/content_web/controllers/posts_controller_test.exs b/apps/content/test/content_web/controllers/posts_controller_test.exs index f0a9d9c7..6a220703 100644 --- a/apps/content/test/content_web/controllers/posts_controller_test.exs +++ b/apps/content/test/content_web/controllers/posts_controller_test.exs @@ -154,7 +154,7 @@ defmodule Legendary.Content.PostsControllerTest do end test "shows the post with pagination", %{conn: conn, posts: posts} do - conn = get conn, Routes.paged_post_path(conn, :show, posts, "2") + conn = get conn, Routes.posts_path(conn, :show, posts, page: "2") assert html_response(conn, 200) =~ posts.title end