hardcode base url for feed
This commit is contained in:
parent
0bcfa53e53
commit
6bee3340a4
1 changed files with 9 additions and 10 deletions
|
|
@ -7,7 +7,6 @@ from django.urls import reverse
|
|||
from django.utils.feedgenerator import Rss201rev2Feed
|
||||
from django.utils.html import strip_tags
|
||||
from django.conf import settings
|
||||
from django.contrib.sites.models import Site
|
||||
|
||||
from .models import Article
|
||||
|
||||
|
|
@ -30,15 +29,7 @@ class ArticleRSSFeed(Feed):
|
|||
|
||||
def item_description(self, item):
|
||||
"""Return the article excerpt with 'Read more' link"""
|
||||
# Get the current site domain for absolute URLs
|
||||
try:
|
||||
current_site = Site.objects.get_current()
|
||||
domain = current_site.domain
|
||||
protocol = "https" if getattr(settings, "USE_TLS", True) else "http"
|
||||
base_url = f"{protocol}://{domain}"
|
||||
except:
|
||||
# Fallback if Site framework is not configured
|
||||
base_url = "https://servala.com"
|
||||
base_url = "https://servala.com"
|
||||
|
||||
# Use the excerpt and add a proper HTML read more link
|
||||
excerpt = strip_tags(item.excerpt)
|
||||
|
|
@ -73,6 +64,14 @@ class ArticleRSSFeed(Feed):
|
|||
"""Return categories for the article"""
|
||||
categories = []
|
||||
|
||||
# Add related entity as category
|
||||
if item.related_service:
|
||||
categories.append(f"Service: {item.related_service.name}")
|
||||
if item.related_consulting_partner:
|
||||
categories.append(f"Partner: {item.related_consulting_partner.name}")
|
||||
if item.related_cloud_provider:
|
||||
categories.append(f"Provider: {item.related_cloud_provider.name}")
|
||||
|
||||
# Add meta keywords as categories if available
|
||||
if item.meta_keywords:
|
||||
keywords = [keyword.strip() for keyword in item.meta_keywords.split(",")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue