[Library|Trunk]

Organization + Result landing: 
	reset id with the dedup id (objidentifier) in case the parameters id was a pid or a canonical url. 
	this  fixes issues with related requests that need the dedup identifier

Result landing:
	- SEO no-index filter: add supplementary rules (title or authors contain spam record keywords e.g film, movie,hd, 4k,etc)
	- when the route is /result?id=  update url with pid if exists.



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60604 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2021-03-08 14:42:26 +00:00
parent 51aa0ba2fd
commit 5791c1452a
4 changed files with 23 additions and 8 deletions

View File

@ -303,6 +303,8 @@ export class OrganizationComponent {
this.errorMessage = 'No organization found';
} else {
this.organizationInfo = data;
this.organizationId = this.organizationInfo.objIdentifier; // reset in case the parameter was a canonical url. The related queries and reports should have the dedup id
this.csvParamsTail = '" and relorganizationid exact "' + this.organizationId + '" ))';
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToOrganization + this.organizationInfo.relcanId);
this.updateTitle((this.organizationInfo.title.name?this.organizationInfo.title.name:(this.organizationInfo.name?this.organizationInfo.name:'No title available')));
this.updateDescription("Organization, country, " +

View File

@ -348,15 +348,15 @@ export class ResultLandingComponent {
this.subscriptions.push(this._resultLandingService.getResultLandingInfo(this.id, this.identifier, this.type, provenanceActionVocabulary, this.properties).subscribe(
data => {
this.resultLandingInfo = data;
this.id = this.resultLandingInfo.objIdentifier;
if(!this.id) {
this.id = this.resultLandingInfo.relcanId;
this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"' + this.id + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":200,"sort":"xaxis","xStyle":{"r":-30,"s":"6","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"' + this.id + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":200,"sort":"xaxis","xStyle":{"r":-30,"s":"6","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
}
if (this.type == "result") { // no type was specified - update URL based this.resultLandingInfo.resultType
this.updateUrlWithType();
}
let pid:Identifier = Identifier.getResultPIDFromIdentifiers(this.resultLandingInfo.identifiers);
if (this.type == "result") { // no type was specified - update URL based this.resultLandingInfo.resultType
this.updateUrlWithType(pid);
}
this.seoService.createLinkForCanonicalURL(this.properties.domain+ properties.baseLink + ( pid ? (this.linkToLandingPage.split("?")[0] + "?pid=" + pid.id):
(this.linkToLandingPage + this.resultLandingInfo.relcanId)));
if ((this.type == "publication") && (this.properties.environment == "beta" || this.properties.environment == "development") && (typeof document !== 'undefined')) {
@ -558,7 +558,7 @@ export class ResultLandingComponent {
return ResultPreview.relationResultConvert(result, this.relation);
}
updateUrlWithType() {
updateUrlWithType(pid) {
this.type = this.resultLandingInfo.resultType;
if (this.type == "publication") {
@ -576,7 +576,8 @@ export class ResultLandingComponent {
this.linkToSearchPage = this.properties.searchLinkToOrps;
}
if(!this.identifier) {
this._location.go(this.linkToLandingPage + this.id);
this._location.go(( pid ? (this.linkToLandingPage.split("?")[0] + "?pid=" + pid.id):
(this.linkToLandingPage + this.id)));
}
// else {
// this._location.go(this.linkToLandingPage.split("?")[0] + "?pid=" + this.identifier.id);
@ -625,7 +626,7 @@ export class ResultLandingComponent {
this.citeModal.alertTitle = "Cite this " + this.getTypeName();
this.citeModal.open();
}
addNoIndexFilter() {
private addNoIndexFilter() {
try {
if(!(this.properties.environment == "production" || this.properties.environment == "development") ) {
return ;
@ -644,7 +645,13 @@ export class ResultLandingComponent {
|| (this.resultLandingInfo.similarResearchResults && this.resultLandingInfo.similarResearchResults.length > 0)
|| (this.resultLandingInfo.supplementaryResearchResults && this.resultLandingInfo.supplementaryResearchResults.length > 0)
|| (this.resultLandingInfo.supplementedByResearchResults && this.resultLandingInfo.supplementedByResearchResults.length > 0)
));
)
);
allow = allow && !(
(this.hasKeyword(this.resultLandingInfo.title.toLowerCase()) || (this.resultLandingInfo.authors && this.hasKeyword(this.resultLandingInfo.authors.join(" ").toLowerCase()))) &&
(this.resultLandingInfo.publisher == "Zenodo" ||
this.resultLandingInfo.hostedBy_collectedFrom.filter( value => {return value.downloadName && value.downloadName.toLowerCase().indexOf("zenodo")!=-1}).length > 0));
if(!allow) {
this._meta.updateTag({content: 'noindex'}, "name='robots'");
}
@ -654,4 +661,8 @@ export class ResultLandingComponent {
return false;
}
}
private hasKeyword(value:string){
let words = ["movie","hd","film","kimetsu", "1080p","4k","call of duty"];
return words.filter( word => { return value.indexOf(word)!=-1}).length > 0;
}
}

View File

@ -126,6 +126,7 @@ export class ResultLandingService {
// res
this.resultLandingInfo.record = data[14];
this.resultLandingInfo.objIdentifier = data[14]["result"]["header"]["dri:objIdentifier"];
this.resultLandingInfo.relcanId = ParsingFunctions.parseRelCanonicalId(this.resultLandingInfo.record, "result");
this.resultLandingInfo.resultType = data[0].resulttype.classid;

View File

@ -20,6 +20,7 @@ export interface Reference {
export class ResultLandingInfo {
relcanId;
objIdentifier: string;
// PUBLICATION, DATASET, SOFTWARE, ORP
record;
resultType: "publication"|"dataset"|"other"|"software";