fix: fetch the hostname from the url to print the current link
This commit is contained in:
parent
16d7d68032
commit
1ee361938e
2 changed files with 17 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
||||||
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:itunesu="http://www.itunesu.com/feed" version="2.0">
|
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:itunesu="http://www.itunesu.com/feed" version="2.0">
|
||||||
<channel>
|
<channel>
|
||||||
<link><%= @podcast.link %></link>
|
<link><%= @podcast.link %></link>
|
||||||
<language><![CDATA[<%= @podcast.language %>]]></language>
|
<language><%= @podcast.language %></language>
|
||||||
<copyright>©2022</copyright>
|
<copyright>©2022</copyright>
|
||||||
<webMaster><![CDATA[<%= @podcast.webmaster %>]]></webMaster>
|
<webMaster><![CDATA[<%= @podcast.webmaster %>]]></webMaster>
|
||||||
<managingEditor><![CDATA[<%= @podcast.webmaster %>]]></managingEditor>
|
<managingEditor><![CDATA[<%= @podcast.webmaster %>]]></managingEditor>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<itunes:keywords><%= @podcast.keywords |> Enum.join(", ") %></itunes:keywords>
|
<itunes:keywords><%= @podcast.keywords |> Enum.join(", ") %></itunes:keywords>
|
||||||
<itunes:explicit><![CDATA[<%= @podcast.explicit %>]]></itunes:explicit>
|
<itunes:explicit><![CDATA[<%= @podcast.explicit %>]]></itunes:explicit>
|
||||||
<itunes:image href="<%= @podcast.image.url %>" />
|
<itunes:image href="<%= @podcast.image.url %>" />
|
||||||
<atom:link href="<%= OpenpodWeb.Endpoint.url <> Routes.feed_path(@conn, :by_identifier, @identifier) %>" rel="self" type="application/rss+xml" />
|
<atom:link href="<%= base_url(@conn) <> Routes.feed_path(@conn, :by_identifier, @identifier) %>" rel="self" type="application/rss+xml" />
|
||||||
<pubDate><%= @podcast.pubDate |> Calendar.DateTime.Format.rfc2822 %></pubDate>
|
<pubDate><%= @podcast.pubDate |> Calendar.DateTime.Format.rfc2822 %></pubDate>
|
||||||
<title><![CDATA[<%= @podcast.title %>]]></title>
|
<title><![CDATA[<%= @podcast.title %>]]></title>
|
||||||
<itunes:author><![CDATA[<%= @podcast.owner.name %>]]></itunes:author>
|
<itunes:author><![CDATA[<%= @podcast.owner.name %>]]></itunes:author>
|
||||||
|
|
|
@ -6,4 +6,19 @@ defmodule OpenpodWeb.FeedView do
|
||||||
sec = length - (min * 60) |> Integer.to_string |> String.pad_leading(2, "0")
|
sec = length - (min * 60) |> Integer.to_string |> String.pad_leading(2, "0")
|
||||||
"#{min}:#{sec}"
|
"#{min}:#{sec}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def base_url(conn) do
|
||||||
|
scheme = conn
|
||||||
|
|> Map.fetch!(:scheme)
|
||||||
|
|> Atom.to_string
|
||||||
|
|
||||||
|
host = conn
|
||||||
|
|> Map.fetch!(:host)
|
||||||
|
|
||||||
|
port = conn
|
||||||
|
|> Map.fetch!(:port)
|
||||||
|
|> Integer.to_string
|
||||||
|
|
||||||
|
"#{scheme}://#{host}:#{port}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue