36 |
36 |
@Input() piwikSiteId = null;
|
37 |
37 |
@Input() hasPrefix: boolean = true;
|
38 |
38 |
@Input() pageTitle = "";
|
|
39 |
pageTitleWithFilters = "";
|
39 |
40 |
@Input() results = [];
|
40 |
41 |
@Input() type;
|
41 |
42 |
@Input() entityType;
|
... | ... | |
154 |
155 |
HelperFunctions.scrollToId("searchForm");
|
155 |
156 |
}
|
156 |
157 |
this.customFilterEnabled = params['cf'] && params['cf'] == "true";
|
157 |
|
});
|
158 |
|
if (!this.includeOnlyResultsAndFilter) {
|
159 |
158 |
if(this.basicMetaDescription.length == 0 ){
|
160 |
159 |
if (this.entityType == "result") {
|
161 |
|
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."];
|
|
160 |
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."];
|
162 |
161 |
} else if (this.entityType == "project") {
|
163 |
|
this.basicMetaDescription = ["Discover research projects and correlated research categorized by Funder and active year. ", "Statistics data about produced research outcomes per year available."];
|
|
162 |
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."];
|
164 |
163 |
} else if (this.entityType == "organization") {
|
165 |
|
this.basicMetaDescription = ["Discover worldwide research organizations from over 100 countries and correlated research. ", "Funding, content providers, research pubblications and research data available."];
|
|
164 |
this.basicMetaDescription = ["Research organization","Discover worldwide research organizations from over 100 countries and correlated research. ", "Funding, content providers, research pubblications and research data available."];
|
166 |
165 |
}else{
|
167 |
166 |
this.basicMetaDescription.push(this.pageTitle)
|
168 |
167 |
}
|
169 |
168 |
}
|
170 |
|
this.metaDescription = this.basicMetaDescription.join(" ");
|
171 |
|
this.updateTitle(this.pageTitle);
|
172 |
|
this.updateDescription();
|
173 |
|
}
|
174 |
|
|
|
169 |
this.updateMeta(this.pageTitle);
|
|
170 |
});
|
175 |
171 |
this.searchUtils.baseUrl = "/" + this.searchUtils.baseUrl;
|
176 |
|
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.router.url, false);
|
177 |
172 |
this.breadcrumbs.push({name: 'home', route: '/'});
|
178 |
173 |
if(this.simpleView) {
|
179 |
174 |
this.breadcrumbs.push( {name: "Search", route: null});
|
... | ... | |
211 |
206 |
});
|
212 |
207 |
}
|
213 |
208 |
|
214 |
|
updateDescription() {
|
215 |
|
// this.metaDescription2 = "";
|
216 |
|
/*if(this.resultTypes){
|
217 |
|
let array = [];
|
218 |
|
for(let type of this.resultTypeOptions){
|
219 |
|
if(this.resultTypes[type.id]== true){
|
220 |
|
array.push(type.name);
|
|
209 |
updateMeta(title:string) {
|
|
210 |
let filterArray = [];
|
|
211 |
let filtervalues = [];
|
|
212 |
let filterURL = "";
|
|
213 |
if(this.resultTypes && this.resultTypes.countSelectedValues> 0){
|
|
214 |
filterURL += ((filterURL.length == 0) ? '?' : '&') + this.resultTypes.filterId + "=";
|
|
215 |
let filterName = this.resultTypes.title+" ";
|
|
216 |
for(let value of this.resultTypes.values){
|
|
217 |
if(value.selected) {
|
|
218 |
filterArray.push(filterName + '"' + value.name + '"');
|
|
219 |
filtervalues.push(value.name);
|
|
220 |
filterURL += ((filterName.length == 0) ? ',' : '') + StringUtils.URIEncode('"' + value.id+ '"' );
|
|
221 |
filterName = "";
|
221 |
222 |
}
|
222 |
223 |
}
|
223 |
|
if(array.length == 0){
|
224 |
|
this.metaDescription += "research outcomes ";
|
225 |
|
}else{
|
226 |
|
this.metaDescription += array.join(", ") + " ";
|
227 |
|
}
|
228 |
|
}else{
|
229 |
|
this.metaDescription = this.pageTitle + " ";
|
230 |
|
}*/
|
231 |
|
let filterArray = [];
|
|
224 |
}
|
232 |
225 |
for(let filter of this.filters){
|
233 |
226 |
if(filter.countSelectedValues> 0){
|
|
227 |
filterURL += ((filterURL.length == 0) ? '?' : '&') + filter.filterId + "=";
|
|
228 |
let filterName = filter.title+" ";
|
234 |
229 |
for(let value of filter.values){
|
235 |
230 |
if(value.selected) {
|
236 |
|
filterArray.push(value.name);
|
|
231 |
filterArray.push(filterName + '"' + value.name + '"');
|
|
232 |
filtervalues.push(value.name);
|
|
233 |
filterURL += ((filterName.length == 0) ? ',' : '') + StringUtils.URIEncode('"' + value.id + '"' );
|
|
234 |
filterName = "";
|
|
235 |
|
237 |
236 |
}
|
238 |
237 |
}
|
239 |
238 |
}
|
240 |
239 |
}
|
241 |
|
for(let field of this.selectedFields){
|
242 |
|
if((field.type == "entity" || field.type == "refine") && field.valueLabel.length > 0 && filterArray.indexOf(field.valueLabel)==-1){
|
243 |
|
filterArray.push(field.valueLabel)
|
244 |
|
}else if(!(field.type == "entity" || field.type == "refine") && field.value.length > 0 && filterArray.indexOf(field.value)==-1) {
|
245 |
|
filterArray.push(field.value);
|
246 |
|
}
|
247 |
|
}
|
248 |
|
this.metaDescription= (filterArray.length > 0?( this.basicMetaDescription[0] + " Filtered by: " + filterArray.join(", ") + " ")
|
249 |
|
:this.basicMetaDescription.join(" "));
|
|
240 |
let nonCanonicalizedPage = (filterArray.length > 0 && filterArray.length<3);
|
|
241 |
this.metaDescription= (nonCanonicalizedPage?( (this.basicMetaDescription[0] + " filtered by: " + filterArray.join(" and ") + ". ") + (this.basicMetaDescription.length > 1 ?this.basicMetaDescription[1]:""))
|
|
242 |
:((this.basicMetaDescription.length > 2 ?this.basicMetaDescription[1] + this.basicMetaDescription[2]:this.basicMetaDescription[0])));
|
250 |
243 |
this._meta.updateTag({content: this.metaDescription}, "name='description'");
|
251 |
244 |
this._meta.updateTag({content: this.metaDescription}, "property='og:description'");
|
|
245 |
this.updateTitle(title, (nonCanonicalizedPage ? filtervalues.join(" | ") + " | ": ""));
|
|
246 |
this.url = this.properties.domain + this.properties.baseLink + this.router.url.split('?')[0] + (nonCanonicalizedPage ? filterURL : "");
|
|
247 |
this.seoService.createLinkForCanonicalURL(this.url, true);
|
252 |
248 |
}
|
253 |
249 |
|
254 |
|
updateTitle(title: string) {
|
255 |
|
var _prefix = "";
|
|
250 |
updateTitle(title: string, filters:string) {
|
|
251 |
let _prefix = "";
|
256 |
252 |
if (this.hasPrefix) {
|
257 |
253 |
_prefix = "OpenAIRE | ";
|
258 |
254 |
}
|
259 |
|
var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title);
|
|
255 |
let _title = _prefix + filters + title;
|
|
256 |
// _title = ((_title.length > 50) ? _title.substring(0, 50) : _title);
|
|
257 |
this.pageTitleWithFilters = _title;
|
260 |
258 |
this._title.setTitle(_title);
|
261 |
259 |
this._meta.updateTag({content: _title}, "property='og:title'");
|
262 |
260 |
}
|
... | ... | |
457 |
455 |
}
|
458 |
456 |
this.filterFilterValues(this.filters);
|
459 |
457 |
if(!this.includeOnlyResultsAndFilter) {
|
460 |
|
this.updateDescription();
|
|
458 |
this.updateMeta(this.pageTitle);
|
461 |
459 |
}
|
462 |
460 |
return filters;
|
463 |
461 |
}
|
... | ... | |
1535 |
1533 |
|
1536 |
1534 |
this.checkSelectedFilters(this.filters);
|
1537 |
1535 |
this.countSelectedFilters(this.filters);
|
|
1536 |
this.updateMeta(this.pageTitle)
|
1538 |
1537 |
return this.filters;
|
1539 |
1538 |
}
|
1540 |
1539 |
|
[Library | Trunk]
Search pages:
updating canonical url with filters
update title with filter values