frenzy/lib/frenzy_web/views/feed_view.ex

14 lines
329 B
Elixir

defmodule FrenzyWeb.FeedView do
use FrenzyWeb, :view
alias Frenzy.Feed
@spec feed_site_url(feed :: Feed.t()) :: String.t()
def feed_site_url(%Feed{site_url: site_url}) when is_binary(site_url) do
site_url
end
def feed_site_url(%Feed{feed_url: feed_url}) do
URI.merge(feed_url, "/") |> to_string()
end
end