diff --git a/apps/content/lib/content/shortcodes.ex b/apps/content/lib/content/shortcodes.ex index 9423e1bb..0bd71cc5 100644 --- a/apps/content/lib/content/shortcodes.ex +++ b/apps/content/lib/content/shortcodes.ex @@ -76,6 +76,10 @@ defmodule Content.Shortcodes do {tag_name, attrs, new_children} end + defp transform_text_nodes(comment = {:comment, _}) do + comment + end + defp processed_text(text) do text = text diff --git a/apps/content/lib/content_web/controllers/posts_controller.ex b/apps/content/lib/content_web/controllers/posts_controller.ex index 25b9c653..b90da69d 100644 --- a/apps/content/lib/content_web/controllers/posts_controller.ex +++ b/apps/content/lib/content_web/controllers/posts_controller.ex @@ -79,6 +79,10 @@ defmodule Content.PostsController do |> render("show.html", post: post, page: 1, thumbs: []) end + def show(conn, %{"id" => "blog", "page" => page_string}) do + conn |> index_posts(%{"id" => "blog", "page" => page_string}) + end + def show(conn, %{"id" => id, "page" => page_string}) do {page_id_for_posts, _} = Options.get_value_as_int("page_for_posts") @@ -87,11 +91,7 @@ defmodule Content.PostsController do if is_nil(post) do try_static_post(conn, id) else - if post.id == page_id_for_posts do - conn |> index_posts(%{"id" => id, "page" => page_string}) - else - conn |> show_one(post, page_string) - end + conn |> show_one(post, page_string) end end def show(conn, %{"id" => id}), do: show(conn, %{"id" => id, "page" => "1"}) diff --git a/apps/content/lib/content_web/templates/posts/index.html.eex b/apps/content/lib/content_web/templates/posts/index.html.eex index c4502eb4..49c53c2d 100644 --- a/apps/content/lib/content_web/templates/posts/index.html.eex +++ b/apps/content/lib/content_web/templates/posts/index.html.eex @@ -1,15 +1,17 @@ <%= for post <- @posts do %> -
-

- <%= link to: Routes.posts_path(@conn, :show, post), class: "u-url" do %> - <%= raw post.post_title %> - <% end %> -

- <%= post_topmatter(@conn, post) %> +
+
+

+ <%= link to: Routes.posts_path(@conn, :show, post), class: "u-url" do %> + <%= raw post.post_title %> + <% end %> +

+ <%= post_topmatter(@conn, post) %> +
<%= if authenticated_for_post?(@conn, post) do %> <%= render "thumb.html", post: post, thumbs: @thumbs %> -
+
<%= raw post |> Content.Post.content_page(1) |> Content.Post.before_more |> process_content |> raw %> <%= if post.post_content =~ "" do %>

@@ -22,41 +24,61 @@ <%= render "password_form.html", post: post, conn: @conn %> <% end %>

-

- Categories: - <%= for term <- post.categories do %> - <%= link term.name, to: Routes.category_path(@conn, :index_posts, term.slug), class: "p-category" %> - <% end %> -

-
+
+
+
+ <%= case post.categories || [] do %> + <% [] -> %> + <%= "" %> + <% categories -> %> + <%= for term <- categories do %> +
+ <%= link term.name, to: Routes.category_path(@conn, :index_posts, term.slug), class: "p-category" %> +
+ <% end %> + <% end %> +
+
+
<% end %> -