diff --git a/lib/philomena/slug.ex b/lib/philomena/slug.ex index 385782d4..61f2baea 100644 --- a/lib/philomena/slug.ex +++ b/lib/philomena/slug.ex @@ -47,8 +47,7 @@ defmodule Philomena.Slug do |> String.replace(":", "-colon-") |> String.replace(".", "-dot-") |> String.replace("+", "-plus-") - |> URI.encode_www_form() - |> String.replace("%20", "+") + |> String.replace(" ", "+") end def slug(_string), do: "" diff --git a/lib/philomena_web/templates/tag/_tag.html.slime b/lib/philomena_web/templates/tag/_tag.html.slime index e654f35a..4bc77882 100644 --- a/lib/philomena_web/templates/tag/_tag.html.slime +++ b/lib/philomena_web/templates/tag/_tag.html.slime @@ -10,7 +10,7 @@ span.tag.dropdown data-tag-category="#{@tag.category}" data-tag-id="#{@tag.id}" span.tag__state.hidden title="Hidden" | H - a.tag__name< href=Routes.tag_path(@conn, :show, @tag) title="#{@tag.short_description}" = @tag.name + a.tag__name< href=pretty_tag_path(@tag) title="#{@tag.short_description}" = @tag.name div.dropdown__content a.tag__dropdown__link.hidden data-method="delete" data-remote="true" data-tag-action="unwatch" href=Routes.tag_watch_path(@conn, :delete, @tag) Unwatch diff --git a/lib/philomena_web/views/tag_view.ex b/lib/philomena_web/views/tag_view.ex index 816e9aed..5b1545b9 100644 --- a/lib/philomena_web/views/tag_view.ex +++ b/lib/philomena_web/views/tag_view.ex @@ -20,6 +20,10 @@ defmodule PhilomenaWeb.TagView do can?(conn, :alias, %Tag{}) end + def pretty_tag_path(%{slug: slug}) do + "/tags/" <> URI.encode(slug, &(&1 == ?+ or URI.char_unescaped?(&1))) + end + def tag_image(%{image: image}) do tag_url_root() <> "/" <> image end