mirror of
https://gitlab.com/tildes/tildes.git
synced 2026-04-16 06:18:34 +02:00
Update feeds to have absolute permalinks
This commit is contained in:
@@ -419,6 +419,11 @@ class Topic(DatabaseModel):
|
||||
"""Return the permalink for this topic."""
|
||||
return f"/~{self.group.path}/{self.topic_id36}/{self.url_slug}"
|
||||
|
||||
@property
|
||||
def permalink_absolute(self) -> str:
|
||||
"""Return the absolute permalink for this topic (domain included)."""
|
||||
return f"https://tildes.net{self.permalink}"
|
||||
|
||||
@property
|
||||
def is_text_type(self) -> bool:
|
||||
"""Return whether this is a text topic."""
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
{% for topic in topics %}
|
||||
<entry>
|
||||
<title><![CDATA[{{ topic.title }}]]></title>
|
||||
<id>https://tildes.net{{ topic.permalink }}</id>
|
||||
<id>{{ topic.permalink_absolute }}</id>
|
||||
{% if topic.is_link_type %}
|
||||
<link rel="alternate" href="{{ topic.link }}"/>
|
||||
{% else %}
|
||||
<link rel="alternate" href="{{ topic.permalink }}"/>
|
||||
<link rel="alternate" href="{{ topic.permalink_absolute }}"/>
|
||||
{% endif %}
|
||||
<content type="html"><![CDATA[
|
||||
{% if topic.is_link_type %}
|
||||
@@ -23,7 +23,7 @@
|
||||
{{ topic.rendered_html|safe }}
|
||||
<hr/>
|
||||
{% endif %}
|
||||
<p>Comments URL: <a href="{{ topic.permalink }}">https://tildes.net{{ topic.permalink }}</a></p>
|
||||
<p>Comments URL: <a href="{{ topic.permalink_absolute }}">{{ topic.permalink_absolute }}</a></p>
|
||||
<p>Votes: {{ topic.num_votes }}</p>
|
||||
<p>Comments: {{ topic.num_comments }}</p>
|
||||
]]></content>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
{% if topic.is_link_type %}
|
||||
<link>{{ topic.link }}</link>
|
||||
{% else %}
|
||||
<link>{{ topic.permalink }}</link>
|
||||
<link>{{ topic.permalink_absolute }}</link>
|
||||
{% endif %}
|
||||
<description><![CDATA[
|
||||
{% if topic.is_link_type %}
|
||||
@@ -24,12 +24,12 @@
|
||||
{{ topic.rendered_html|safe }}
|
||||
<hr/>
|
||||
{% endif %}
|
||||
<p>Comments URL: <a href="{{ topic.permalink }}">https://tildes.net{{ topic.permalink }}</a></p>
|
||||
<p>Comments URL: <a href="{{ topic.permalink_absolute }}">{{ topic.permalink_absolute }}</a></p>
|
||||
<p>Votes: {{ topic.num_votes }}</p>
|
||||
<p>Comments: {{ topic.num_comments }}</p>
|
||||
]]></description>
|
||||
<author>{{ topic.user.username }}</author>
|
||||
<comments>{{ topic.permalink }}</comments>
|
||||
<comments>{{ topic.permalink_absolute }}</comments>
|
||||
<pubDate>{{ topic.created_time.strftime("%a, %d %b %Y %T %z") }}</pubDate>
|
||||
</item>
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user