output correct javascript tag

This commit is contained in:
Tobias Brunner 2025-03-28 11:17:47 +01:00
parent b35ce84792
commit 4fdc2e0115
No known key found for this signature in database

View file

@ -48,16 +48,14 @@ def json_ld_structured_data(context):
view_name = resolved_view.url_name view_name = resolved_view.url_name
except Resolver404: except Resolver404:
# For 404 pages or other unresolvable URLs, return minimal data # For 404 pages or other unresolvable URLs, return minimal data
return mark_safe( data = {
json.dumps(
{
"@context": "https://schema.org", "@context": "https://schema.org",
"@type": "WebSite", "@type": "WebSite",
"name": "Servala - Open Cloud Native Service Hub", "name": "Servala - Open Cloud Native Service Hub",
"url": base_url, "url": base_url,
} }
) json_ld = json.dumps(data, indent=2)
) return mark_safe(f'<script type="application/ld+json">{json_ld}</script>')
# Handle different page types # Handle different page types
if view_name == "homepage": if view_name == "homepage":