basic implementation of json-ld

This commit is contained in:
Tobias Brunner 2025-03-27 15:49:59 +01:00
parent 3e1b6d95b6
commit d69b540fcc
No known key found for this signature in database
4 changed files with 9 additions and 6 deletions

View file

@ -42,7 +42,7 @@ jobs:
container: catthehacker/ubuntu:act-latest
environment:
name: prod
url: https://serva.la/
url: https://servala.com/
steps:
- name: Checkout repository

View file

@ -35,6 +35,6 @@ deploy:
- oc -n ${NAMESPACE} rollout restart deployment/servala
environment:
name: prod
url: https://poc.serva.la/
url: https://servala.com/
only:
- main

View file

@ -1,6 +1,7 @@
{% load static %}
{% load canonical_tags %}
{% load social_meta_tags %}
{% load json_ld_tags %}
<!DOCTYPE html>
<html lang="en">
<head>
@ -12,6 +13,7 @@
<link rel="icon" type="image/x-icon" href="{% static "img/favicon.ico" %}">
<link rel="sitemap" type="application/xml" title="Sitemap" href="/sitemap.xml">
{% social_meta_tags %}
{% json_ld_structured_data %}
<link rel="stylesheet" href='{% static "css/bootstrap-icons.min.css" %}'>
<link rel="stylesheet" type="text/css" href='{% static "css/servala-main.css" %}'>

View file

@ -11,6 +11,7 @@ register = template.Library()
def json_ld_structured_data(context):
"""
Generates appropriate JSON-LD structured data based on the current page.
For schemas, see https://schema.org/
"""
request = context["request"]
current_url = request.path
@ -30,8 +31,8 @@ def json_ld_structured_data(context):
"contactPoint": {
"@type": "ContactPoint",
"telephone": "+41 44 545 53 00",
"email": "hi@serva.la",
"contactType": "Customer Support",
"email": "hi@servala.com",
"contactType": "Sales",
},
"address": {
"@type": "PostalAddress",
@ -52,7 +53,7 @@ def json_ld_structured_data(context):
"description": "Servala connects businesses, developers, and cloud service providers on one unique hub with secure, scalable, and easy-to-use cloud-native services.",
"potentialAction": {
"@type": "SearchAction",
"target": f"{base_url}/services/?search={{search_term_string}}",
"target": f"{base_url}/service/?search={{search_term_string}}",
"query-input": "required name=search_term_string",
},
}
@ -62,7 +63,7 @@ def json_ld_structured_data(context):
"@context": "https://schema.org",
"@type": "CollectionPage",
"name": "Cloud Services - Servala",
"url": f"{base_url}/services/",
"url": f"{base_url}/service/",
"description": "Explore all available cloud services on Servala, with new services added regularly.",
"isPartOf": {"@type": "WebSite", "name": "Servala", "url": base_url},
}