From 3e35d179f5a052bac691e267be50bdbbabe91f69 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Thu, 17 Jul 2025 10:52:58 +0200 Subject: [PATCH] add rss feed to articles --- .../templates/services/article_detail.html | 5 +++++ .../templates/services/article_list.html | 18 +++++++++++++++++- hub/services/urls.py | 2 ++ hub/sitemaps.py | 19 ++++++++++++++++++- hub/urls.py | 2 ++ 5 files changed, 44 insertions(+), 2 deletions(-) diff --git a/hub/services/templates/services/article_detail.html b/hub/services/templates/services/article_detail.html index c9f3cdb..cd23d36 100644 --- a/hub/services/templates/services/article_detail.html +++ b/hub/services/templates/services/article_detail.html @@ -6,6 +6,11 @@ {% block meta_description %}{{ article.excerpt }}{% endblock %} {% block meta_keywords %}{{ article.meta_keywords }}{% endblock %} +{% block extra_head %} + + +{% endblock %} + {% block content %}
diff --git a/hub/services/templates/services/article_list.html b/hub/services/templates/services/article_list.html index a1b0712..52d990e 100644 --- a/hub/services/templates/services/article_list.html +++ b/hub/services/templates/services/article_list.html @@ -5,13 +5,29 @@ {% block title %}Articles{% endblock %} {% block meta_description %}Explore all articles on Servala, covering cloud services, consulting partners, and cloud provider insights.{% endblock %} +{% block extra_head %} + + +{% endblock %} + {% block content %}

Articles

-

Discover insights, guides, and updates about cloud services, consulting partners, and technology trends.

+

Discover insights, guides, and updates about cloud services, consulting partners, and technology trends.

+ +
diff --git a/hub/services/urls.py b/hub/services/urls.py index d03881a..2f098ea 100644 --- a/hub/services/urls.py +++ b/hub/services/urls.py @@ -1,5 +1,6 @@ from django.urls import path from . import views +from .feeds import ArticleRSSFeed app_name = "services" @@ -19,6 +20,7 @@ urlpatterns = [ path("provider//", views.provider_detail, name="provider_detail"), path("partner//", views.partner_detail, name="partner_detail"), path("articles/", views.article_list, name="article_list"), + path("articles/rss/", ArticleRSSFeed(), name="article_rss"), path("article//", views.article_detail, name="article_detail"), path("contact/", views.leads.contact, name="contact"), path("contact/thank-you/", views.thank_you, name="thank_you"), diff --git a/hub/sitemaps.py b/hub/sitemaps.py index ecdcb37..6530487 100644 --- a/hub/sitemaps.py +++ b/hub/sitemaps.py @@ -5,6 +5,7 @@ from hub.services.models import ( CloudProvider, ConsultingPartner, ServiceOffering, + Article, ) @@ -13,7 +14,12 @@ class StaticSitemap(Sitemap): priority = 1.0 def items(self): - return ["services:homepage", "services:contact"] + return [ + "services:homepage", + "services:contact", + "services:article_list", + "services:article_rss", + ] def location(self, item): return reverse(item) @@ -60,3 +66,14 @@ class ConsultingPartnerSitemap(Sitemap): def lastmod(self, obj): return obj.updated_at + + +class ArticleSitemap(Sitemap): + changefreq = "weekly" + priority = 0.8 + + def items(self): + return Article.objects.filter(is_published=True) + + def lastmod(self, obj): + return obj.updated_at diff --git a/hub/urls.py b/hub/urls.py index ef0f1c8..da84670 100644 --- a/hub/urls.py +++ b/hub/urls.py @@ -16,6 +16,7 @@ from .sitemaps import ( OfferingSitemap, CloudProviderSitemap, ConsultingPartnerSitemap, + ArticleSitemap, ) @@ -37,6 +38,7 @@ sitemaps = { "offerings": OfferingSitemap, "providers": CloudProviderSitemap, "partners": ConsultingPartnerSitemap, + "articles": ArticleSitemap, } urlpatterns = [