Skip to content

Commit 680e2da

Browse files
jor4scienceatarix83
authored andcommitted
Google Dataset Search: added description metadata to product-creative-work-schema-type.ts (edited online on Bitbucket)
1 parent 8c6a0a6 commit 680e2da

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/app/core/metadata/schema-json-ld/schema-types/product/product-creative-work-schema-type.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ import { schemaJsonLDForEntity } from '../schema-type-decorator';
66
export class ProductCreativeWorkSchemaType extends SchemaType {
77

88
protected createSchema(item: Item): Record<string, any> {
9+
10+
let description: string;
11+
if (!SchemaType.getMetadataValue(item, 'dc.description')) {
12+
description = SchemaType.getMetadataValue(item, 'dc.description.abstract');
13+
} else {
14+
description = SchemaType.getMetadataValue(item, 'dc.description');
15+
}
16+
917
return {
1018
'@context': 'https://schema.org',
1119
'@type': 'CreativeWork',
@@ -18,6 +26,7 @@ export class ProductCreativeWorkSchemaType extends SchemaType {
1826
'inLanguage': SchemaType.getMetadataValue(item, 'dc.language.iso'),
1927
'genre': SchemaType.getMetadataValue(item, 'dc.subject'),
2028
'abstract': SchemaType.getMetadataValue(item, 'dc.description.abstract'),
29+
'description': description,
2130
'funding': SchemaType.getMetadataValue(item, 'dc.relation.funding'),
2231
'sponsor': SchemaType.getMetadataValue(item, 'dc.description.sponsorship')
2332
};

0 commit comments

Comments
 (0)