add rss feed to articles

This commit is contained in:
Tobias Brunner 2025-07-17 10:52:58 +02:00
parent edf453244d
commit 3e35d179f5
Signed by: tobru
SSH key fingerprint: SHA256:kOXg1R6c11XW3/Pt9dbLdQvOJGFAy+B2K6v6PtRWBGQ
5 changed files with 44 additions and 2 deletions

View file

@ -6,6 +6,11 @@
{% block meta_description %}{{ article.excerpt }}{% endblock %}
{% block meta_keywords %}{{ article.meta_keywords }}{% endblock %}
{% block extra_head %}
<!-- RSS Feed -->
<link rel="alternate" type="application/rss+xml" title="Servala Articles RSS Feed" href="{% url 'services:article_rss' %}">
{% endblock %}
{% block content %}
<section class="section bg-primary-subtle">
<div class="container mx-auto px-20 px-lg-0 pt-40 pb-60">

View file

@ -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 %}
<!-- RSS Feed -->
<link rel="alternate" type="application/rss+xml" title="Servala Articles RSS Feed" href="{% url 'services:article_rss' %}">
{% endblock %}
{% block content %}
<section class="section bg-primary-subtle">
<div class="container mx-auto px-20 px-lg-0 pt-40 pb-60">
<header class="section-primary__header text-center">
<h1 class="section-h1 fs-40 fs-lg-64 mb-24">Articles</h1>
<div class="text-gray-300 w-lg-37 mx-auto">
<p class="mb-0">Discover insights, guides, and updates about cloud services, consulting partners, and technology trends.</p>
<p class="mb-3">Discover insights, guides, and updates about cloud services, consulting partners, and technology trends.</p>
<!-- RSS Feed Link -->
<div class="mb-0">
<a href="{% url 'services:article_rss' %}" class="btn btn-outline-light btn-sm" title="Subscribe to RSS Feed">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="me-2">
<path d="M4 11a9 9 0 0 1 9 9" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M4 4a16 16 0 0 1 16 16" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<circle cx="5" cy="19" r="1" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
Subscribe to RSS Feed
</a>
</div>
</div>
</header>
</div>

View file

@ -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/<slug:slug>/", views.provider_detail, name="provider_detail"),
path("partner/<slug:slug>/", views.partner_detail, name="partner_detail"),
path("articles/", views.article_list, name="article_list"),
path("articles/rss/", ArticleRSSFeed(), name="article_rss"),
path("article/<slug:slug>/", views.article_detail, name="article_detail"),
path("contact/", views.leads.contact, name="contact"),
path("contact/thank-you/", views.thank_you, name="thank_you"),

View file

@ -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

View file

@ -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 = [