diff --git a/lib/chiya/notes/note.ex b/lib/chiya/notes/note.ex index fa1e65b..c906081 100644 --- a/lib/chiya/notes/note.ex +++ b/lib/chiya/notes/note.ex @@ -3,6 +3,11 @@ defmodule Chiya.Notes.Note do import Ecto.Changeset alias Chiya.Notes.{Note, NoteSlug, NoteNote, NoteTag} + use Phoenix.VerifiedRoutes, + endpoint: ChiyaWeb.Endpoint, + router: ChiyaWeb.Router, + statics: ChiyaWeb.static_paths() + @reserved_slugs ~w(user admin dev api) @derive {Jason.Encoder, only: [:id, :name, :content, :slug, :channels]} @@ -46,7 +51,8 @@ defmodule Chiya.Notes.Note do end def note_url(note) do - URI.merge(ChiyaWeb.Endpoint.url(), note.slug) |> to_string() + URI.merge(ChiyaWeb.Endpoint.url(), ~p"/note/#{note.slug}") + |> to_string() end @doc false diff --git a/lib/chiya/notes/references.ex b/lib/chiya/notes/references.ex index 4729795..9b8cf8d 100644 --- a/lib/chiya/notes/references.ex +++ b/lib/chiya/notes/references.ex @@ -153,7 +153,8 @@ defmodule Chiya.Notes.References do target_id: linked_id } - defp get_link(slug, title, valid), do: "[#{title}](#{~p"/#{slug}"})#{get_link_class(valid)}" + defp get_link(slug, title, valid), + do: "[#{title}](#{~p"/note/#{slug}"})#{get_link_class(valid)}" defp get_link_class(false), do: "{:.invalid}" defp get_link_class(_), do: "" diff --git a/lib/chiya_web/components/layouts/root_public.html.heex b/lib/chiya_web/components/layouts/root_public.html.heex index a2577ef..4030e2e 100644 --- a/lib/chiya_web/components/layouts/root_public.html.heex +++ b/lib/chiya_web/components/layouts/root_public.html.heex @@ -68,7 +68,7 @@ <%= identity.name %> <.dot /> <% end %> - About + About <.dot /> Admin
diff --git a/lib/chiya_web/components/public_components.ex b/lib/chiya_web/components/public_components.ex index 0477d71..cdb2ff0 100644 --- a/lib/chiya_web/components/public_components.ex +++ b/lib/chiya_web/components/public_components.ex @@ -85,7 +85,7 @@ defmodule ChiyaWeb.PublicComponents do <% end %> <%= note.name %> @@ -113,7 +113,7 @@ defmodule ChiyaWeb.PublicComponents do <%= pretty_datetime(note.published_at) %> <.dot /> - Permalink + Permalink <%= if not Enum.empty?(note.images) do %> <.dot /> <.icon name="hero-photo" /> @@ -130,7 +130,7 @@ defmodule ChiyaWeb.PublicComponents do