SEO - jsonld: parse all subjects put keep at most 10
This commit is contained in:
parent
ec4d727aaa
commit
c1213b9836
|
@ -314,7 +314,7 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
|
|||
return array;
|
||||
}
|
||||
|
||||
private getKeyword(result: any): String[] {
|
||||
private getKeyword(result: any, classification:'FOS'|'SDG' |null = null): String[] {
|
||||
const subjects = _.get(result, "result.metadata.oaf:entity.oaf:result.subject", null);
|
||||
if (!subjects) return null;
|
||||
if (!Array.isArray(subjects)) return null;
|
||||
|
@ -324,7 +324,7 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
|
|||
const subjectArray = subjects as Array<any>;
|
||||
for (var i = 0; i < subjectArray.length; i += 1) {
|
||||
const classid = _.get(subjectArray[i], "classid", null);
|
||||
if (classid !== "keyword") continue;
|
||||
if(classification && classid !==classification) continue;
|
||||
|
||||
const sub = _.get(subjectArray[i], "content", null);
|
||||
if (!sub) return null;
|
||||
|
@ -332,7 +332,7 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
|
|||
array.push(sub as String);
|
||||
}
|
||||
if (array.length == 0) return null;
|
||||
return array;
|
||||
return array.slice(0,10);
|
||||
}
|
||||
|
||||
private getCreator(result: any): Person[] {
|
||||
|
|
Loading…
Reference in New Issue