Project

General

Profile

« Previous | Next » 

Revision 60976

[Library | Trunk]
Search pages:
updating canonical url with filters
update title with filter values

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/advancedSearchForm.component.ts
24 24
  @Input() advancedSearchLinkParameters;
25 25
  @Input() simpleView:boolean = false;
26 26
  @Input() formPlaceholderText = "Type Keywords...";
27
  @Input() pageTitle;
28 27
  @Output() queryChange  = new EventEmitter();
29 28
  @Input()resultTypes;
30 29
  @Input()  quickFilter:{filter: Filter, selected:boolean, filterId:string, value:string};
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/datasourcesHelper.class.ts
32 32
  }
33 33
  public static getDescription(type: "all" | "registries" | "journals" | "compatible" | "deposit") {
34 34
    if (type == "registries") {
35
      return ["Discover research Entity Registries.","For each entity are available description and the research projects managed. Categorized by type and OpenAIRE compatibility level."];
35
      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."];
36 36
    } else if (type == "journals") {
37
      return ["Discover research Journals. ","For each entity are available description, subjects, related content providers, publications and research outcomes per year and type."];
37
      return ["Research journals","Discover research Journals. ","For each entity are available description, subjects, related content providers, publications and research outcomes per year and type."];
38 38
    } else if (type == "compatible") {
39
      return ["Discover publication, data, software, istitutional and thematic repositories.","Available repository research outcomes per year and type."];
39
      return ["research repositories", "Discover publication, data, software, istitutional and thematic repositories.","Available repository research outcomes per year and type."];
40 40
    } else {
41
      return ["Discover worldwide research content providers and correlated research.","Statistics data about produced research outocomes per year available."];
41
      return ["Content providers","Discover worldwide research content providers and correlated research.","Statistics data about produced research outocomes per year available."];
42 42
    }
43 43
  }
44 44
  public static getQueryPrefix(type: "all" | "registries" | "journals" | "compatible" | "deposit"): string {
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/newSearchPage.component.html
177 177
            [advancedSearchLink]="advancedSearchLink"
178 178
            [advancedSearchLinkParameters]
179 179
                  ="this.routerHelper.createQueryParams(this.parameterNames, this.parameterValues)"
180
            [pageTitle]=pageTitle [simpleView]="simpleView" [formPlaceholderText]="formPlaceholderText"
180
             [simpleView]="simpleView" [formPlaceholderText]="formPlaceholderText"
181 181
            [resultTypes]="resultTypes" [quickFilter]="quickFilter" [entitiesSelection]="entitiesSelection"
182 182
            [showSwitchSearchLink]="showSwitchSearchLink" [customFilter]="customFilter"
183 183
          >
......
190 190
    </div>
191 191
  </div>
192 192
</div>
193
<schema2jsonld *ngIf="!includeOnlyResultsAndFilter && url" [URL]="url" type="search" [name]=pageTitle
193
<schema2jsonld *ngIf="url" [URL]="url" type="search" [name]=pageTitleWithFilters
194 194
               [searchAction]=false [description]="metaDescription" ></schema2jsonld>
195 195

  
196 196

  
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/newSearchPage.component.ts
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

  
modules/uoa-services-library/trunk/ng-openaire-library/src/app/landingPages/result/resultLanding.component.ts
362 362
        this.canonicalUrl = this.properties.domain+ properties.baseLink  + ( pid ? (this.linkToLandingPage.split("?")[0] + "?pid=" + encodeURIComponent(pid.id)):
363 363
          (this.linkToLandingPage + this.resultLandingInfo.relcanId));
364 364
        this.seoService.createLinkForCanonicalURL(this.canonicalUrl);
365
        this.updateUrl(this.canonicalUrl);
365 366
        if ((this.type == "publication") && (this.properties.environment == "beta" || this.properties.environment == "development") && (typeof document !== 'undefined')) {
366 367
          this.getOpenCitations();
367 368
        }

Also available in: Unified diff