Features: 1) Add hreflang to metadata response across viewsets; 2) Update GraphQL schema to use hreflang as a string instead of a list.
Fixes: 1) Correct `hreflang` field type in serializers and GraphQL object types. Extra: Refactor redundant `hreflang` handling; ensure uniform `LANGUAGE_CODE` usage throughout.
This commit is contained in:
parent
6539a63f4f
commit
2f4cceaa6a
3 changed files with 8 additions and 5 deletions
|
|
@ -68,7 +68,7 @@ class SEOMetaType(ObjectType):
|
|||
open_graph = GenericScalar()
|
||||
twitter = GenericScalar()
|
||||
json_ld = List(GenericScalar)
|
||||
hreflang = List(GenericScalar)
|
||||
hreflang = String()
|
||||
|
||||
|
||||
class AttributeType(DjangoObjectType):
|
||||
|
|
@ -173,7 +173,7 @@ class BrandType(DjangoObjectType):
|
|||
"open_graph": og,
|
||||
"twitter": tw,
|
||||
"json_ld": json_ld,
|
||||
"hreflang": [],
|
||||
"hreflang": info.context.LANGUAGE_CODE,
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -336,7 +336,7 @@ class CategoryType(DjangoObjectType):
|
|||
"open_graph": og,
|
||||
"twitter": tw,
|
||||
"json_ld": json_ld,
|
||||
"hreflang": [],
|
||||
"hreflang": info.context.LANGUAGE_CODE,
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -590,7 +590,7 @@ class ProductType(DjangoObjectType):
|
|||
"open_graph": og,
|
||||
"twitter": tw,
|
||||
"json_ld": json_ld,
|
||||
"hreflang": [],
|
||||
"hreflang": info.context.LANGUAGE_CODE,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class SeoSnapshotSerializer(Serializer):
|
|||
description = CharField()
|
||||
canonical = CharField()
|
||||
robots = CharField()
|
||||
hreflang = ListField(child=DictField(), required=False)
|
||||
hreflang = CharField()
|
||||
open_graph = DictField()
|
||||
twitter = DictField()
|
||||
json_ld = ListField(child=DictField())
|
||||
|
|
|
|||
|
|
@ -369,6 +369,7 @@ class CategoryViewSet(EvibesViewSet):
|
|||
"description": description,
|
||||
"canonical": canonical,
|
||||
"robots": "index,follow",
|
||||
"hreflang": request.LANGUAGE_CODE,
|
||||
"open_graph": og,
|
||||
"twitter": tw,
|
||||
"json_ld": json_ld,
|
||||
|
|
@ -492,6 +493,7 @@ class BrandViewSet(EvibesViewSet):
|
|||
"description": description,
|
||||
"canonical": canonical,
|
||||
"robots": "index,follow",
|
||||
"hreflang": request.LANGUAGE_CODE,
|
||||
"open_graph": og,
|
||||
"twitter": tw,
|
||||
"json_ld": json_ld,
|
||||
|
|
@ -618,6 +620,7 @@ class ProductViewSet(EvibesViewSet):
|
|||
"description": description,
|
||||
"canonical": canonical,
|
||||
"robots": "index,follow",
|
||||
"hreflang": request.LANGUAGE_CODE,
|
||||
"open_graph": og,
|
||||
"twitter": tw,
|
||||
"json_ld": json_ld,
|
||||
|
|
|
|||
Loading…
Reference in a new issue