From e590e996cf6c9427ce1454c28ab502bf88167651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Thu, 22 Feb 2018 17:57:32 +0100 Subject: [PATCH] feeds: also use an absolute URL for item image --- panikweb/paniktags/templatetags/paniktags.py | 6 ++++++ panikweb_templates/templates/feed/newsitem.html | 2 +- panikweb_templates/templates/feed/soundfile.html | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/panikweb/paniktags/templatetags/paniktags.py b/panikweb/paniktags/templatetags/paniktags.py index 9748317..61e357a 100644 --- a/panikweb/paniktags/templatetags/paniktags.py +++ b/panikweb/paniktags/templatetags/paniktags.py @@ -367,3 +367,9 @@ def set_absolute_urls(text): text = text.replace('src="/', 'src="%s' % settings.WEBSITE_BASE_URL) text = text.replace('href="/', 'href="%s' % settings.WEBSITE_BASE_URL) return text + +@register.filter +def as_absolute_url(url): + if url.startswith('/'): + url = settings.WEBSITE_BASE_URL + url.lstrip('/') + return url diff --git a/panikweb_templates/templates/feed/newsitem.html b/panikweb_templates/templates/feed/newsitem.html index 5d7a8ce..3b969ae 100644 --- a/panikweb_templates/templates/feed/newsitem.html +++ b/panikweb_templates/templates/feed/newsitem.html @@ -1,7 +1,7 @@ {% load paniktags thumbnail %} {% if obj.image %} {% thumbnail obj.image "320x240" crop="50% 25%" as im %} - + {% endthumbnail %} {% endif %} diff --git a/panikweb_templates/templates/feed/soundfile.html b/panikweb_templates/templates/feed/soundfile.html index f2717af..ea5222b 100644 --- a/panikweb_templates/templates/feed/soundfile.html +++ b/panikweb_templates/templates/feed/soundfile.html @@ -1,7 +1,7 @@ {% load paniktags thumbnail %} {% if obj.episode.image %} {% thumbnail obj.episode.image "320x240" crop="50% 25%" as im %} - + {% endthumbnail %} {% endif %} -- GitLab