diff --git a/hub/services/static/img/servala-logo.png b/hub/services/static/img/servala-logo.png index af1fd9d..af5de89 100644 Binary files a/hub/services/static/img/servala-logo.png and b/hub/services/static/img/servala-logo.png differ diff --git a/hub/services/templatetags/json_ld_tags.py b/hub/services/templatetags/json_ld_tags.py index 138f13e..3741bfe 100644 --- a/hub/services/templatetags/json_ld_tags.py +++ b/hub/services/templatetags/json_ld_tags.py @@ -297,6 +297,81 @@ def json_ld_structured_data(context): "seller": {"@type": "Organization", "name": "VSHN"}, } + elif view_name == "article_list": + data = { + "@context": "https://schema.org", + "@type": "CollectionPage", + "name": "Servala Articles", + "url": f"{base_url}/articles/", + "description": "Read our latest articles about cloud services, best practices, and industry insights.", + "isPartOf": {"@type": "WebSite", "name": "Servala", "url": base_url}, + } + + elif view_name == "article_detail" and "article" in context: + article = context["article"] + article_url = request.build_absolute_uri() + + data = { + "@context": "https://schema.org", + "@type": "Article", + "headline": article.title, + "description": article.excerpt, + "url": article_url, + "author": { + "@type": "Person", + "name": article.author.get_full_name() or article.author.username, + }, + "publisher": { + "@type": "Organization", + "name": "Servala", + "logo": { + "@type": "ImageObject", + "url": f"{base_url}/static/img/servala-logo.png", + }, + }, + } + + # Add publication date using article_date field + if article.article_date: + data["datePublished"] = article.article_date.isoformat() + + # Add modification date + if article.updated_at: + data["dateModified"] = article.updated_at.isoformat() + + # Add image using the model's get_image property or get_og_image + if article.get_og_image: + data["image"] = request.build_absolute_uri(article.get_og_image.url) + elif article.get_image: + data["image"] = request.build_absolute_uri(article.get_image.url) + + # Add keywords from meta_keywords field + if article.meta_keywords: + data["keywords"] = article.meta_keywords + + # Add main entity of page + data["mainEntityOfPage"] = { + "@type": "WebPage", + "@id": article_url, + } + + # Add about field based on related entities + if article.related_service: + data["about"] = { + "@type": "SoftwareApplication", + "name": article.related_service.name, + } + elif article.related_consulting_partner: + data["about"] = { + "@type": "Organization", + "name": article.related_consulting_partner.name, + } + elif article.related_cloud_provider: + data["about"] = { + "@type": "Organization", + "name": article.related_cloud_provider.name, + } + else: # Default to organization data if no specific page type matches data = organization_data