strip HTML for research outcomes description (landing and search results), Update no-index filter (remove poor content filter, add filter for communities)

This commit is contained in:
argirok 2021-07-26 13:05:36 +03:00
parent 410643a682
commit 58b44c7bb0
4 changed files with 28 additions and 10 deletions

View File

@ -22,6 +22,7 @@ import {Subscriber} from "rxjs";
import {Session} from "../../login/utils/helper.class";
import {AnnotationComponent} from "../annotation/annotation.component";
import {ParsingFunctions} from "../landing-utils/parsingFunctions.class";
import {ConnectHelper} from "../../connect/connectHelper";
@Component({
@ -643,6 +644,8 @@ export class ResultLandingComponent {
if(!(this.properties.environment == "production" || this.properties.environment == "development") ) {
return ;
}else {
/*
//comment out poor content filters
let allow = !!(!this.resultLandingInfo.underCurationMessage &&
((this.resultLandingInfo.fundedByProjects && this.resultLandingInfo.fundedByProjects.length > 0)
|| this.resultLandingInfo.journal
@ -658,10 +661,11 @@ export class ResultLandingComponent {
|| (this.resultLandingInfo.supplementaryResearchResults && this.resultLandingInfo.supplementaryResearchResults.length > 0)
|| (this.resultLandingInfo.supplementedByResearchResults && this.resultLandingInfo.supplementedByResearchResults.length > 0)
)
);
);*/
let allow = true;
// console.log("rich content " + allow)
//spam words to exclude
let title_authors_words = ["movie","hd","film","kimetsu", "1080p","4k","call of duty", "mobile hack", "TUBYDI", "电影","電影"];
let title_authors_words = ["movie","hd","film","kimetsu", "1080p","4k","call of duty", "mobile hack", "TUBYDI", "电影","電影","download ebook","download [ebook]"];
let abstract_words = ["operacao-feliz-natal.blogspot.com", "moviedouban.site", "hack-expert-solution.link"];
allow = allow && !(
(this.hasKeyword(this.resultLandingInfo.title,title_authors_words) || (this.resultLandingInfo.authors && this.hasKeyword(this.resultLandingInfo.authors.map(o => o.fullName).join(" "),title_authors_words))
@ -679,6 +683,15 @@ export class ResultLandingComponent {
(this.resultLandingInfo.authors && this.hasKeyword("_"+this.resultLandingInfo.authors.map(o => o.fullName).join("_")+"_",common_authors, "_"))
);
// console.log("common content " + allow)
//community filter
allow = allow && ((properties.adminToolsPortalType == 'explore' && (!this.resultLandingInfo.contexts || this.resultLandingInfo.contexts.length == 0)) ||
(properties.adminToolsPortalType != 'explore' && properties.adminToolsPortalType != 'community') ||
(properties.adminToolsPortalType == 'community' && (!!this.resultLandingInfo.contexts &&
this.resultLandingInfo.contexts.filter( context => { return ConnectHelper.getCommunityFromDomain(properties.domain) == context.idContext }).length > 0)
)
);
// console.log("community " + allow )
if(!allow) {
this._meta.updateTag({content: 'noindex'}, "name='robots'");
}

View File

@ -6,7 +6,7 @@ import {EnvProperties} from '../../utils/properties/env-properties';
import {ParsingFunctions} from '../landing-utils/parsingFunctions.class';
import {map} from "rxjs/operators";
import {HostedByCollectedFrom, Organization} from "../../utils/result-preview/result-preview";
import {Dates, Identifier} from "../../utils/string-utils.class";
import {Dates, Identifier, StringUtils} from "../../utils/string-utils.class";
import {properties} from "../../../../environments/environment";
@Injectable()
@ -143,6 +143,9 @@ export class ResultLandingService {
//this.resultLandingInfo.description = String(data[0].description[0]);
this.resultLandingInfo.description = (data[0] && data[0].description[0]) ? String(data[0].description[0]) : "";
}
try{
this.resultLandingInfo.description = StringUtils.HTMLToString(this.resultLandingInfo.description);
} catch (e) {}
this.resultLandingInfo.embargoEndDate = data[0].embargoenddate?Dates.getDate(data[0].embargoenddate):null;
}

View File

@ -349,7 +349,9 @@ export class SearchResearchResultsService {
} else {
result.description = (resData.description[0]) ? String(resData.description[0]) : "";
}
try{
result.description = StringUtils.HTMLToString(result.description);
} catch (e) {}
if (result.description && result.description.length > this.sizeOfDescription) {
result.description = result.description.substring(0, this.sizeOfDescription) + "...";
}

View File

@ -6,7 +6,7 @@
<div>
<img style="margin-right: 8px; float: left;"
[src]="assetsPath + 'common/commission.jpg'"
alt="flag black white low" width="50" height="33" loading="lazy">
alt="flag black white low" width="50px" height="33px" loading="lazy">
</div>
<helper *ngIf="divContents && divContents['footer']?.length > 0"
[texts]="divContents['footer']"></helper>
@ -24,8 +24,8 @@
</div>
<div *ngIf="showOpenaire" class="uk-text-right uk-width-1-2">
<img [src]="assetsPath + 'common/Logo_Horizontal_'+(darkBackground?'white':'dark')+'_small.png'"
data-width="126"
data-height="30" class="el-image" alt="OpenAIRE" loading="lazy">
width="126px"
height="30px" class="el-image" alt="OpenAIRE" loading="lazy">
</div>
</div>
</ng-container>
@ -41,8 +41,8 @@
<div *ngIf="showOpenaire"
[class]="(centered?'uk-width-1-1 uk-width-1-4@m uk-text-center':'')">
<img [src]="assetsPath + 'common/Logo_Horizontal_'+(darkBackground?'white':'dark')+'_small.png'"
data-width="126"
data-height="30" class="el-image" alt="OpenAIRE" loading="lazy">
width="126px"
height="30px" class="el-image" alt="OpenAIRE" loading="lazy">
</div>
<div *ngIf="showCommision" id="footer#5"
[class]="'uk-text-left '+(centered?' uk-margin uk-width-expand':' uk-margin-left')">
@ -61,7 +61,7 @@
<div>
<img style="margin-right: 8px; float: left;"
[src]="assetsPath + 'common/commission.jpg'"
alt="flag black white low" width="50" height="33" loading="lazy">
alt="flag black white low" width="50px" height="33px" loading="lazy">
</div>
<div class="uk-margin-left">
<helper *ngIf="divContents && divContents['footer']?.length > 0"