fix(rss): use absolute URLs for thumbnail images
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e0e145c70f
commit
a703991e62
@ -26,6 +26,15 @@ SITE_URL = 'https://nordabiznes.pl'
|
||||
ORG_NAME = 'Izba Gospodarcza Norda Biznes'
|
||||
|
||||
|
||||
def _full_url(path):
|
||||
"""Ensure URLs are absolute (prefix SITE_URL if path is relative)."""
|
||||
if not path:
|
||||
return ''
|
||||
if path.startswith(('http://', 'https://')):
|
||||
return path
|
||||
return f'{SITE_URL}{path}'
|
||||
|
||||
|
||||
def _rss_date(dt):
|
||||
"""Format datetime to RFC 822 for RSS pubDate."""
|
||||
if isinstance(dt, date) and not isinstance(dt, datetime):
|
||||
@ -89,7 +98,7 @@ def feed_events():
|
||||
items.append({
|
||||
'title': e.title,
|
||||
'link': f'{SITE_URL}/kalendarz/{e.id}',
|
||||
'thumbnail': e.image_url or '',
|
||||
'thumbnail': _full_url(e.image_url),
|
||||
'creator': e.organizer_name or ORG_NAME,
|
||||
'content': e.description or '',
|
||||
'datawydarzenia': _kig_date(e.event_date),
|
||||
@ -121,7 +130,7 @@ def feed_news():
|
||||
items.append({
|
||||
'title': a.title,
|
||||
'link': f'{SITE_URL}/ogloszenia/{a.slug}',
|
||||
'thumbnail': a.image_url or '',
|
||||
'thumbnail': _full_url(a.image_url),
|
||||
'creator': ORG_NAME,
|
||||
'content': a.excerpt or a.content or '',
|
||||
'datawydarzenia': '',
|
||||
@ -150,7 +159,7 @@ def feed_pej():
|
||||
items.append({
|
||||
'title': n.title,
|
||||
'link': n.url or f'{SITE_URL}/pej/aktualnosci',
|
||||
'thumbnail': n.image_url or '',
|
||||
'thumbnail': _full_url(n.image_url),
|
||||
'creator': n.source_name or ORG_NAME,
|
||||
'content': n.ai_summary or n.description or '',
|
||||
'datawydarzenia': '',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user