[Library|Trunk]
SEO updates: url in results preview: - use pid? and the first valid pid if available - use the canonical id instead of dedup if available git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60410 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
8a315f3963
commit
fd8a89ffe5
|
@ -152,7 +152,7 @@ export class ResultLandingComponent {
|
|||
this.id = data["id"];
|
||||
this.initMetaAndLinks("result");
|
||||
} else if (data["pid"]) {
|
||||
this.identifier = Identifier.getIdentifierFromString(data["pid"]);
|
||||
this.identifier = Identifier.getIdentifierFromString(decodeURIComponent(data["pid"]));
|
||||
|
||||
if(!this.type) {
|
||||
this.type = "result";
|
||||
|
|
|
@ -8,6 +8,7 @@ import {RefineResultsUtils} from './servicesUtils/refineResults.class';
|
|||
import{EnvProperties} from '../utils/properties/env-properties';
|
||||
import {StringUtils} from '../utils/string-utils.class';
|
||||
import {map} from "rxjs/operators";
|
||||
import {ParsingFunctions} from "../landingPages/landing-utils/parsingFunctions.class";
|
||||
|
||||
@Injectable()
|
||||
export class SearchOrganizationsService {
|
||||
|
@ -101,7 +102,10 @@ export class SearchOrganizationsService {
|
|||
//result['title'].url = OpenaireProperties.getsearchLinkToOrganization();
|
||||
//result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
|
||||
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
|
||||
|
||||
let canId = ParsingFunctions.parseRelCanonicalId(Array.isArray(data) ? data[i] : data, "organization");
|
||||
if(canId){
|
||||
result['id'] = canId;
|
||||
}
|
||||
if(resData['rels'].hasOwnProperty("rel")) {
|
||||
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
|
||||
|
||||
|
|
|
@ -271,6 +271,10 @@ export class SearchResearchResultsService {
|
|||
}
|
||||
|
||||
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
|
||||
let canId = ParsingFunctions.parseRelCanonicalId(Array.isArray(data) ? data[i] : data, "result");
|
||||
if(canId){
|
||||
result['id'] = canId;
|
||||
}
|
||||
if(resData['bestaccessright'] && resData['bestaccessright'].hasOwnProperty("classname")) {
|
||||
result['title'].accessMode = resData['bestaccessright'].classname;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import {RouterHelper} from "../routerHelper.class";
|
|||
import {AlertModal} from "../modal/alert";
|
||||
import {properties} from "../../../../environments/environment";
|
||||
import {Session} from "../../login/utils/helper.class";
|
||||
import {Identifier} from "../string-utils.class";
|
||||
|
||||
@Component({
|
||||
selector: 'result-preview',
|
||||
|
@ -55,6 +56,13 @@ export class ResultPreviewComponent implements OnInit{
|
|||
this.urlParam = "id";
|
||||
this.url = properties.searchLinkToResult.split('?')[0];
|
||||
}
|
||||
// if result has a pid use it as parameter instead of openaireId
|
||||
let pid:Identifier = Identifier.getResultPIDFromIdentifiers(this.result.identifiers);
|
||||
if(pid){
|
||||
this.urlParam = "pid";
|
||||
this.result.id = encodeURIComponent(pid.id);
|
||||
|
||||
}
|
||||
this.initBeforeTitle();
|
||||
if(this.result.languages) {
|
||||
this.result.languages = this.removeUnknown(this.result.languages);
|
||||
|
|
|
@ -158,6 +158,23 @@ export class Identifier {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static getResultPIDFromIdentifiers(identifiers: Map<string, string[]>): Identifier {
|
||||
let classes:string [] = ["doi", "handle", "pmc", "pmid"];
|
||||
if(identifiers) {
|
||||
for (let cl of classes){
|
||||
if(identifiers.get(cl)){
|
||||
for (let pid of identifiers.get(cl)) {
|
||||
let identifier = Identifier.getIdentifierFromString(pid);
|
||||
if (identifier){
|
||||
return identifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static isValidDOI(str: string): boolean {
|
||||
var exp1 = /\b(10[.][0-9]{4,}(?:[.][0-9]+)*\/(?:(?!["&\'<>])\S)+)\b/g
|
||||
var exp2 = /\b(10[.][0-9]{4,}(?:[.][0-9]+)*\/(?:(?!["&\'<>])[[:graph:]])+)\b/g
|
||||
|
|
Loading…
Reference in New Issue