[Library | Trunk]

Search pages: 
	updating canonical url with filters
	update title with filter values



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60976 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2021-04-28 15:54:30 +00:00
parent 0e6b1e13ca
commit d97a4d6f69
5 changed files with 47 additions and 48 deletions

View File

@ -362,6 +362,7 @@ export class ResultLandingComponent {
this.canonicalUrl = this.properties.domain+ properties.baseLink + ( pid ? (this.linkToLandingPage.split("?")[0] + "?pid=" + encodeURIComponent(pid.id)):
(this.linkToLandingPage + this.resultLandingInfo.relcanId));
this.seoService.createLinkForCanonicalURL(this.canonicalUrl);
this.updateUrl(this.canonicalUrl);
if ((this.type == "publication") && (this.properties.environment == "beta" || this.properties.environment == "development") && (typeof document !== 'undefined')) {
this.getOpenCitations();
}

View File

@ -24,7 +24,6 @@ export class AdvancedSearchFormComponent {
@Input() advancedSearchLinkParameters;
@Input() simpleView:boolean = false;
@Input() formPlaceholderText = "Type Keywords...";
@Input() pageTitle;
@Output() queryChange = new EventEmitter();
@Input()resultTypes;
@Input() quickFilter:{filter: Filter, selected:boolean, filterId:string, value:string};

View File

@ -32,13 +32,13 @@ export class DatasourcesHelperClass {
}
public static getDescription(type: "all" | "registries" | "journals" | "compatible" | "deposit") {
if (type == "registries") {
return ["Discover research Entity Registries.","For each entity are available description and the research projects managed. Categorized by type and OpenAIRE compatibility level."];
return ["Entity Registries","Discover research Entity Registries.","For each entity are available description and the research projects managed. Categorized by type and OpenAIRE compatibility level."];
} else if (type == "journals") {
return ["Discover research Journals. ","For each entity are available description, subjects, related content providers, publications and research outcomes per year and type."];
return ["Research journals","Discover research Journals. ","For each entity are available description, subjects, related content providers, publications and research outcomes per year and type."];
} else if (type == "compatible") {
return ["Discover publication, data, software, istitutional and thematic repositories.","Available repository research outcomes per year and type."];
return ["research repositories", "Discover publication, data, software, istitutional and thematic repositories.","Available repository research outcomes per year and type."];
} else {
return ["Discover worldwide research content providers and correlated research.","Statistics data about produced research outocomes per year available."];
return ["Content providers","Discover worldwide research content providers and correlated research.","Statistics data about produced research outocomes per year available."];
}
}
public static getQueryPrefix(type: "all" | "registries" | "journals" | "compatible" | "deposit"): string {

View File

@ -177,7 +177,7 @@
[advancedSearchLink]="advancedSearchLink"
[advancedSearchLinkParameters]
="this.routerHelper.createQueryParams(this.parameterNames, this.parameterValues)"
[pageTitle]=pageTitle [simpleView]="simpleView" [formPlaceholderText]="formPlaceholderText"
[simpleView]="simpleView" [formPlaceholderText]="formPlaceholderText"
[resultTypes]="resultTypes" [quickFilter]="quickFilter" [entitiesSelection]="entitiesSelection"
[showSwitchSearchLink]="showSwitchSearchLink" [customFilter]="customFilter"
>
@ -190,7 +190,7 @@
</div>
</div>
</div>
<schema2jsonld *ngIf="!includeOnlyResultsAndFilter && url" [URL]="url" type="search" [name]=pageTitle
<schema2jsonld *ngIf="url" [URL]="url" type="search" [name]=pageTitleWithFilters
[searchAction]=false [description]="metaDescription" ></schema2jsonld>

View File

@ -36,6 +36,7 @@ export class NewSearchPageComponent {
@Input() piwikSiteId = null;
@Input() hasPrefix: boolean = true;
@Input() pageTitle = "";
pageTitleWithFilters = "";
@Input() results = [];
@Input() type;
@Input() entityType;
@ -154,26 +155,20 @@ export class NewSearchPageComponent {
HelperFunctions.scrollToId("searchForm");
}
this.customFilterEnabled = params['cf'] && params['cf'] == "true";
});
if (!this.includeOnlyResultsAndFilter) {
if(this.basicMetaDescription.length == 0 ){
if (this.entityType == "result") {
this.basicMetaDescription = ["Discover" + (this.properties.adminToolsCommunity == 'openaire'?"over 100 million of":"")+" research outcomes ", "categorized by research type, year range, funder, languages, community and content providers."];
this.basicMetaDescription = ["Research outcomes","Discover" + (this.properties.adminToolsCommunity == 'openaire'?" over 100 million of":"")+" research outcomes ", "categorized by research type, year range, funder, languages, community and content providers."];
} else if (this.entityType == "project") {
this.basicMetaDescription = ["Discover research projects and correlated research categorized by Funder and active year. ", "Statistics data about produced research outcomes per year available."];
this.basicMetaDescription = ["Research projects", "Discover research projects and correlated research categorized by Funder and active year. ", "Statistics data about produced research outcomes per year available."];
} else if (this.entityType == "organization") {
this.basicMetaDescription = ["Discover worldwide research organizations from over 100 countries and correlated research. ", "Funding, content providers, research pubblications and research data available."];
this.basicMetaDescription = ["Research organization","Discover worldwide research organizations from over 100 countries and correlated research. ", "Funding, content providers, research pubblications and research data available."];
}else{
this.basicMetaDescription.push(this.pageTitle)
}
}
this.metaDescription = this.basicMetaDescription.join(" ");
this.updateTitle(this.pageTitle);
this.updateDescription();
}
this.updateMeta(this.pageTitle);
});
this.searchUtils.baseUrl = "/" + this.searchUtils.baseUrl;
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.router.url, false);
this.breadcrumbs.push({name: 'home', route: '/'});
if(this.simpleView) {
this.breadcrumbs.push( {name: "Search", route: null});
@ -211,52 +206,55 @@ export class NewSearchPageComponent {
});
}
updateDescription() {
// this.metaDescription2 = "";
/*if(this.resultTypes){
let array = [];
for(let type of this.resultTypeOptions){
if(this.resultTypes[type.id]== true){
array.push(type.name);
updateMeta(title:string) {
let filterArray = [];
let filtervalues = [];
let filterURL = "";
if(this.resultTypes && this.resultTypes.countSelectedValues> 0){
filterURL += ((filterURL.length == 0) ? '?' : '&') + this.resultTypes.filterId + "=";
let filterName = this.resultTypes.title+" ";
for(let value of this.resultTypes.values){
if(value.selected) {
filterArray.push(filterName + '"' + value.name + '"');
filtervalues.push(value.name);
filterURL += ((filterName.length == 0) ? ',' : '') + StringUtils.URIEncode('"' + value.id+ '"' );
filterName = "";
}
}
if(array.length == 0){
this.metaDescription += "research outcomes ";
}else{
this.metaDescription += array.join(", ") + " ";
}
}else{
this.metaDescription = this.pageTitle + " ";
}*/
let filterArray = [];
}
for(let filter of this.filters){
if(filter.countSelectedValues> 0){
filterURL += ((filterURL.length == 0) ? '?' : '&') + filter.filterId + "=";
let filterName = filter.title+" ";
for(let value of filter.values){
if(value.selected) {
filterArray.push(value.name);
filterArray.push(filterName + '"' + value.name + '"');
filtervalues.push(value.name);
filterURL += ((filterName.length == 0) ? ',' : '') + StringUtils.URIEncode('"' + value.id + '"' );
filterName = "";
}
}
}
}
for(let field of this.selectedFields){
if((field.type == "entity" || field.type == "refine") && field.valueLabel.length > 0 && filterArray.indexOf(field.valueLabel)==-1){
filterArray.push(field.valueLabel)
}else if(!(field.type == "entity" || field.type == "refine") && field.value.length > 0 && filterArray.indexOf(field.value)==-1) {
filterArray.push(field.value);
}
}
this.metaDescription= (filterArray.length > 0?( this.basicMetaDescription[0] + " Filtered by: " + filterArray.join(", ") + " ")
:this.basicMetaDescription.join(" "));
let nonCanonicalizedPage = (filterArray.length > 0 && filterArray.length<3);
this.metaDescription= (nonCanonicalizedPage?( (this.basicMetaDescription[0] + " filtered by: " + filterArray.join(" and ") + ". ") + (this.basicMetaDescription.length > 1 ?this.basicMetaDescription[1]:""))
:((this.basicMetaDescription.length > 2 ?this.basicMetaDescription[1] + this.basicMetaDescription[2]:this.basicMetaDescription[0])));
this._meta.updateTag({content: this.metaDescription}, "name='description'");
this._meta.updateTag({content: this.metaDescription}, "property='og:description'");
this.updateTitle(title, (nonCanonicalizedPage ? filtervalues.join(" | ") + " | ": ""));
this.url = this.properties.domain + this.properties.baseLink + this.router.url.split('?')[0] + (nonCanonicalizedPage ? filterURL : "");
this.seoService.createLinkForCanonicalURL(this.url, true);
}
updateTitle(title: string) {
var _prefix = "";
updateTitle(title: string, filters:string) {
let _prefix = "";
if (this.hasPrefix) {
_prefix = "OpenAIRE | ";
}
var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title);
let _title = _prefix + filters + title;
// _title = ((_title.length > 50) ? _title.substring(0, 50) : _title);
this.pageTitleWithFilters = _title;
this._title.setTitle(_title);
this._meta.updateTag({content: _title}, "property='og:title'");
}
@ -457,7 +455,7 @@ export class NewSearchPageComponent {
}
this.filterFilterValues(this.filters);
if(!this.includeOnlyResultsAndFilter) {
this.updateDescription();
this.updateMeta(this.pageTitle);
}
return filters;
}
@ -1535,6 +1533,7 @@ public static createRangeFilterQuery(rangeField,selectedFromValue, selectedToVal
this.checkSelectedFilters(this.filters);
this.countSelectedFilters(this.filters);
this.updateMeta(this.pageTitle)
return this.filters;
}