output correct javascript tag
This commit is contained in:
parent
b35ce84792
commit
4fdc2e0115
1 changed files with 8 additions and 10 deletions
|
@ -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":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue