From d738597882e08457ddc9de1a04f83a57ec386e87 Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Thu, 17 Dec 2020 11:54:38 +0000 Subject: [PATCH] [Library | trunk] result landing: updates on method and filtering rules for noindex tag git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60158 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../result/resultLanding.component.ts | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index 9e6299ad..10b60ae3 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -319,10 +319,7 @@ export class ResultLandingComponent { if ((this.type == "publication") && (this.properties.environment == "beta" || this.properties.environment == "development") && (typeof document !== 'undefined')) { this.getOpenCitations(); } - if(this.resultLandingInfo.underCurationMessage && this.properties == "production"){ - //set noindex for newly added records - this._meta.updateTag({content: 'noindex'}, "name='robots'"); - } + this.addNoIndexFilter(); if (this.resultLandingInfo.title) { this.updateTitle(this.resultLandingInfo.title); this.updateDescription((this.resultLandingInfo.description ? (this.resultLandingInfo.description) : ("," + this.resultLandingInfo.title))); @@ -573,4 +570,30 @@ export class ResultLandingComponent { this.citeModal.alertTitle = "Cite this " + this.getTypeName() + " to"; this.citeModal.open(); } + addNoIndexFilter() { + try { + if(this.properties.environment != "production") { + return ; + }else { + let addFilter = !(!this.resultLandingInfo.underCurationMessage && + ((this.resultLandingInfo.fundedByProjects && this.resultLandingInfo.fundedByProjects.length > 0) + || this.resultLandingInfo.journal + || (this.resultLandingInfo.otherSubjects && this.resultLandingInfo.otherSubjects.size > 0) + || (this.resultLandingInfo.classifiedSubjects && this.resultLandingInfo.classifiedSubjects.size > 0) + || (this.resultLandingInfo.organizations && this.resultLandingInfo.organizations.length > 0) + || this.resultLandingInfo.bioentities || (this.resultLandingInfo.references && this.resultLandingInfo.references.length > 0) + || (this.resultLandingInfo.relatedResearchResults && this.resultLandingInfo.relatedResearchResults.length > 0) + || (this.resultLandingInfo.similarResearchResults && this.resultLandingInfo.similarResearchResults.length > 0) + || (this.resultLandingInfo.supplementaryResearchResults && this.resultLandingInfo.supplementaryResearchResults.length > 0) + || (this.resultLandingInfo.supplementedByResearchResults && this.resultLandingInfo.supplementedByResearchResults.length > 0) + )); + if(addFilter) { + this._meta.updateTag({content: 'noindex'}, "name='robots'"); + } + } + } catch (e) { + console.error("Error in passNoIndexFilter()", this.resultLandingInfo.relcanId, e); + return false; + } + } }