[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:
parent
0e6b1e13ca
commit
d97a4d6f69
|
@ -362,6 +362,7 @@ export class ResultLandingComponent {
|
||||||
this.canonicalUrl = this.properties.domain+ properties.baseLink + ( pid ? (this.linkToLandingPage.split("?")[0] + "?pid=" + encodeURIComponent(pid.id)):
|
this.canonicalUrl = this.properties.domain+ properties.baseLink + ( pid ? (this.linkToLandingPage.split("?")[0] + "?pid=" + encodeURIComponent(pid.id)):
|
||||||
(this.linkToLandingPage + this.resultLandingInfo.relcanId));
|
(this.linkToLandingPage + this.resultLandingInfo.relcanId));
|
||||||
this.seoService.createLinkForCanonicalURL(this.canonicalUrl);
|
this.seoService.createLinkForCanonicalURL(this.canonicalUrl);
|
||||||
|
this.updateUrl(this.canonicalUrl);
|
||||||
if ((this.type == "publication") && (this.properties.environment == "beta" || this.properties.environment == "development") && (typeof document !== 'undefined')) {
|
if ((this.type == "publication") && (this.properties.environment == "beta" || this.properties.environment == "development") && (typeof document !== 'undefined')) {
|
||||||
this.getOpenCitations();
|
this.getOpenCitations();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ export class AdvancedSearchFormComponent {
|
||||||
@Input() advancedSearchLinkParameters;
|
@Input() advancedSearchLinkParameters;
|
||||||
@Input() simpleView:boolean = false;
|
@Input() simpleView:boolean = false;
|
||||||
@Input() formPlaceholderText = "Type Keywords...";
|
@Input() formPlaceholderText = "Type Keywords...";
|
||||||
@Input() pageTitle;
|
|
||||||
@Output() queryChange = new EventEmitter();
|
@Output() queryChange = new EventEmitter();
|
||||||
@Input()resultTypes;
|
@Input()resultTypes;
|
||||||
@Input() quickFilter:{filter: Filter, selected:boolean, filterId:string, value:string};
|
@Input() quickFilter:{filter: Filter, selected:boolean, filterId:string, value:string};
|
||||||
|
|
|
@ -32,13 +32,13 @@ export class DatasourcesHelperClass {
|
||||||
}
|
}
|
||||||
public static getDescription(type: "all" | "registries" | "journals" | "compatible" | "deposit") {
|
public static getDescription(type: "all" | "registries" | "journals" | "compatible" | "deposit") {
|
||||||
if (type == "registries") {
|
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") {
|
} 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") {
|
} 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 {
|
} 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 {
|
public static getQueryPrefix(type: "all" | "registries" | "journals" | "compatible" | "deposit"): string {
|
||||||
|
|
|
@ -177,7 +177,7 @@
|
||||||
[advancedSearchLink]="advancedSearchLink"
|
[advancedSearchLink]="advancedSearchLink"
|
||||||
[advancedSearchLinkParameters]
|
[advancedSearchLinkParameters]
|
||||||
="this.routerHelper.createQueryParams(this.parameterNames, this.parameterValues)"
|
="this.routerHelper.createQueryParams(this.parameterNames, this.parameterValues)"
|
||||||
[pageTitle]=pageTitle [simpleView]="simpleView" [formPlaceholderText]="formPlaceholderText"
|
[simpleView]="simpleView" [formPlaceholderText]="formPlaceholderText"
|
||||||
[resultTypes]="resultTypes" [quickFilter]="quickFilter" [entitiesSelection]="entitiesSelection"
|
[resultTypes]="resultTypes" [quickFilter]="quickFilter" [entitiesSelection]="entitiesSelection"
|
||||||
[showSwitchSearchLink]="showSwitchSearchLink" [customFilter]="customFilter"
|
[showSwitchSearchLink]="showSwitchSearchLink" [customFilter]="customFilter"
|
||||||
>
|
>
|
||||||
|
@ -190,7 +190,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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>
|
[searchAction]=false [description]="metaDescription" ></schema2jsonld>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ export class NewSearchPageComponent {
|
||||||
@Input() piwikSiteId = null;
|
@Input() piwikSiteId = null;
|
||||||
@Input() hasPrefix: boolean = true;
|
@Input() hasPrefix: boolean = true;
|
||||||
@Input() pageTitle = "";
|
@Input() pageTitle = "";
|
||||||
|
pageTitleWithFilters = "";
|
||||||
@Input() results = [];
|
@Input() results = [];
|
||||||
@Input() type;
|
@Input() type;
|
||||||
@Input() entityType;
|
@Input() entityType;
|
||||||
|
@ -154,26 +155,20 @@ export class NewSearchPageComponent {
|
||||||
HelperFunctions.scrollToId("searchForm");
|
HelperFunctions.scrollToId("searchForm");
|
||||||
}
|
}
|
||||||
this.customFilterEnabled = params['cf'] && params['cf'] == "true";
|
this.customFilterEnabled = params['cf'] && params['cf'] == "true";
|
||||||
});
|
|
||||||
if (!this.includeOnlyResultsAndFilter) {
|
|
||||||
if(this.basicMetaDescription.length == 0 ){
|
if(this.basicMetaDescription.length == 0 ){
|
||||||
if (this.entityType == "result") {
|
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") {
|
} 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") {
|
} 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{
|
}else{
|
||||||
this.basicMetaDescription.push(this.pageTitle)
|
this.basicMetaDescription.push(this.pageTitle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.metaDescription = this.basicMetaDescription.join(" ");
|
this.updateMeta(this.pageTitle);
|
||||||
this.updateTitle(this.pageTitle);
|
});
|
||||||
this.updateDescription();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.searchUtils.baseUrl = "/" + this.searchUtils.baseUrl;
|
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: '/'});
|
this.breadcrumbs.push({name: 'home', route: '/'});
|
||||||
if(this.simpleView) {
|
if(this.simpleView) {
|
||||||
this.breadcrumbs.push( {name: "Search", route: null});
|
this.breadcrumbs.push( {name: "Search", route: null});
|
||||||
|
@ -211,52 +206,55 @@ export class NewSearchPageComponent {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
updateDescription() {
|
updateMeta(title:string) {
|
||||||
// this.metaDescription2 = "";
|
|
||||||
/*if(this.resultTypes){
|
|
||||||
let array = [];
|
|
||||||
for(let type of this.resultTypeOptions){
|
|
||||||
if(this.resultTypes[type.id]== true){
|
|
||||||
array.push(type.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(array.length == 0){
|
|
||||||
this.metaDescription += "research outcomes ";
|
|
||||||
}else{
|
|
||||||
this.metaDescription += array.join(", ") + " ";
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
this.metaDescription = this.pageTitle + " ";
|
|
||||||
}*/
|
|
||||||
let filterArray = [];
|
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 = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
for(let filter of this.filters){
|
for(let filter of this.filters){
|
||||||
if(filter.countSelectedValues> 0){
|
if(filter.countSelectedValues> 0){
|
||||||
|
filterURL += ((filterURL.length == 0) ? '?' : '&') + filter.filterId + "=";
|
||||||
|
let filterName = filter.title+" ";
|
||||||
for(let value of filter.values){
|
for(let value of filter.values){
|
||||||
if(value.selected) {
|
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){
|
let nonCanonicalizedPage = (filterArray.length > 0 && filterArray.length<3);
|
||||||
if((field.type == "entity" || field.type == "refine") && field.valueLabel.length > 0 && filterArray.indexOf(field.valueLabel)==-1){
|
this.metaDescription= (nonCanonicalizedPage?( (this.basicMetaDescription[0] + " filtered by: " + filterArray.join(" and ") + ". ") + (this.basicMetaDescription.length > 1 ?this.basicMetaDescription[1]:""))
|
||||||
filterArray.push(field.valueLabel)
|
:((this.basicMetaDescription.length > 2 ?this.basicMetaDescription[1] + this.basicMetaDescription[2]:this.basicMetaDescription[0])));
|
||||||
}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(" "));
|
|
||||||
this._meta.updateTag({content: this.metaDescription}, "name='description'");
|
this._meta.updateTag({content: this.metaDescription}, "name='description'");
|
||||||
this._meta.updateTag({content: this.metaDescription}, "property='og: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) {
|
updateTitle(title: string, filters:string) {
|
||||||
var _prefix = "";
|
let _prefix = "";
|
||||||
if (this.hasPrefix) {
|
if (this.hasPrefix) {
|
||||||
_prefix = "OpenAIRE | ";
|
_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._title.setTitle(_title);
|
||||||
this._meta.updateTag({content: _title}, "property='og:title'");
|
this._meta.updateTag({content: _title}, "property='og:title'");
|
||||||
}
|
}
|
||||||
|
@ -457,7 +455,7 @@ export class NewSearchPageComponent {
|
||||||
}
|
}
|
||||||
this.filterFilterValues(this.filters);
|
this.filterFilterValues(this.filters);
|
||||||
if(!this.includeOnlyResultsAndFilter) {
|
if(!this.includeOnlyResultsAndFilter) {
|
||||||
this.updateDescription();
|
this.updateMeta(this.pageTitle);
|
||||||
}
|
}
|
||||||
return filters;
|
return filters;
|
||||||
}
|
}
|
||||||
|
@ -1535,6 +1533,7 @@ public static createRangeFilterQuery(rangeField,selectedFromValue, selectedToVal
|
||||||
|
|
||||||
this.checkSelectedFilters(this.filters);
|
this.checkSelectedFilters(this.filters);
|
||||||
this.countSelectedFilters(this.filters);
|
this.countSelectedFilters(this.filters);
|
||||||
|
this.updateMeta(this.pageTitle)
|
||||||
return this.filters;
|
return this.filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue