diff --git a/app/community/routes.py b/app/community/routes.py index 25fdc294..28dfb2f1 100644 --- a/app/community/routes.py +++ b/app/community/routes.py @@ -190,7 +190,7 @@ def show_community(community: Community): SUBSCRIPTION_MEMBER=SUBSCRIPTION_MEMBER, SUBSCRIPTION_OWNER=SUBSCRIPTION_OWNER, SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR, etag=f"{community.id}{sort}{post_layout}_{hash(community.last_active)}", related_communities=related_communities, next_url=next_url, prev_url=prev_url, low_bandwidth=low_bandwidth, - rss_feed=f"https://{current_app.config['SERVER_NAME']}/community/{community.link()}/feed", rss_feed_name=f"{community.title} posts on PieFed", + rss_feed=f"https://{current_app.config['SERVER_NAME']}/community/{community.link()}/feed", rss_feed_name=f"{community.title} on PieFed", content_filters=content_filters, moderating_communities=moderating_communities(current_user.get_id()), joined_communities=joined_communities(current_user.get_id()), sort=sort, inoculation=inoculation[randint(0, len(inoculation) - 1)], post_layout=post_layout, current_app=current_app) @@ -216,7 +216,7 @@ def show_community_rss(actor): og_image = community.image.source_url if community.image_id else None fg = FeedGenerator() fg.id(f"https://{current_app.config['SERVER_NAME']}/c/{actor}") - fg.title(community.title) + fg.title(f'{community.title} on {g.site.name}') fg.link(href=f"https://{current_app.config['SERVER_NAME']}/c/{actor}", rel='alternate') if og_image: fg.logo(og_image) diff --git a/app/templates/topic/show_topic.html b/app/templates/topic/show_topic.html index 977ae796..3af75077 100644 --- a/app/templates/topic/show_topic.html +++ b/app/templates/topic/show_topic.html @@ -80,6 +80,9 @@ {% endfor %}
{{ _('Explore communities') }}
++ RSS feed +
{% endif %} diff --git a/app/topic/routes.py b/app/topic/routes.py index 8c6559dd..cb494b89 100644 --- a/app/topic/routes.py +++ b/app/topic/routes.py @@ -1,7 +1,8 @@ -from datetime import timedelta +from datetime import timedelta, timezone from random import randint -from flask import request, flash, json, url_for, current_app, redirect, abort +from feedgen.feed import FeedGenerator +from flask import request, flash, json, url_for, current_app, redirect, abort, make_response, g from flask_login import login_required, current_user from flask_babel import _ from sqlalchemy import text, desc, or_ @@ -79,6 +80,8 @@ def show_topic(topic_name): return render_template('topic/show_topic.html', title=_(topic.name), posts=posts, topic=topic, sort=sort, page=page, post_layout=post_layout, next_url=next_url, prev_url=prev_url, topic_communities=topic_communities, content_filters=content_filters, + rss_feed=f"https://{current_app.config['SERVER_NAME']}/topic/{topic_name}.rss", + rss_feed_name=f"{topic.name} on {g.site.name}", show_post_community=True, moderating_communities=moderating_communities(current_user.get_id()), joined_communities=joined_communities(current_user.get_id()), inoculation=inoculation[randint(0, len(inoculation) - 1)], @@ -87,6 +90,43 @@ def show_topic(topic_name): abort(404) +@bp.route('/topic/