Project

General

Profile

« Previous | Next » 

Revision 59152

[Library|Trunk]

JSONLD:
-Home page:
-Add description in Website with search action
-In every search page add description based on the filters
-In (project, content provider, organization) landing add description if available otherwise use the title
-In project add id in funder entity

Autocomplete: create event emitter to update entity or refine result label (used in jsonld)

View differences:

newSearchPage.component.ts
57 57
  @Input() rangeFilters: RangeFilter[] = [];
58 58
  @Input() rangeFields: string[][] = [];
59 59
  @Input() refineFields = [];
60
  @Input() filters = [];
60
  @Input() filters:Filter[] = [];
61 61
  selectedFilters: number = 0;
62 62
  selectedRangeFilters: number = 0;
63 63
  private searchFieldsHelper: SearchFields = new SearchFields();
......
101 101
  public errorCodes: ErrorCodes = new ErrorCodes();
102 102
  breadcrumbs:Breadcrumb[] = [];
103 103
  url = null;
104

  
104
  metaDescription = "";
105 105
  @Input() entitiesSelection:boolean = true;
106 106
  @Input() showAdvancedSearchLink:boolean = true;
107 107

  
......
128 128
        this.resultsPerPage = data.envSpecific.resultsPerPage;
129 129
        this.csvLimit = data.envSpecific.csvLimit;
130 130
        this.isPiwikEnabled = data.envSpecific.enablePiwikTrack;
131
        if (typeof window !== 'undefined') {
132
          this.updateUrl(data.envSpecific.baseLink + location.pathname);
133
          this.url = data.envSpecific.baseLink + location.pathname
134
        }
131
        this.updateUrl(data.envSpecific.baseLink +this.router.url);
132
        this.url = data.envSpecific.baseLink + this.router.url;
135 133
        if (typeof document !== 'undefined' && this.isPiwikEnabled) {
136 134
          this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, this.piwikSiteId).subscribe();
137 135
        }
......
142 140
      }
143 141
      this.customFilterEnabled = params['cf'] && params['cf'] == "true";
144 142
    });
145
    var description = "Openaire, search, repositories, open access, type, content provider, funder, project, " + this.pageTitle;
143
    this.metaDescription = this.pageTitle;
146 144

  
147 145
    this.updateTitle(this.pageTitle);
148
    this.updateDescription(description);
146
    this.updateDescription();
149 147

  
150 148
    this.searchUtils.baseUrl = "/" + this.searchUtils.baseUrl;
151 149
    this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.router.url, false);
......
179 177
    }
180 178
  }
181 179

  
182
  updateDescription(description: string) {
183
    this._meta.updateTag({content: description}, "name='description'");
184
    this._meta.updateTag({content: description}, "property='og:description'");
180
  updateDescription() {
181
    this.metaDescription = "Search results for ";
182
    if(this.resultTypes){
183
      let array = [];
184
      for(let type of this.resultTypeOptions){
185
        if(this.resultTypes[type.id]== true){
186
          array.push(type.name);
187
        }
188
      }
189
      if(array.length == 0){
190
        this.metaDescription += "research outcomes ";
191
      }else{
192
        this.metaDescription += array.join(", ") + " ";
193
      }
194
    }else{
195
      this.metaDescription = this.pageTitle + " ";
196
    }
197
    let filterArray = [];
198
    for(let filter of this.filters){
199
      if(filter.countSelectedValues> 0){
200
       for(let value of filter.values){
201
         if(value.selected) {
202
           filterArray.push(value.name);
203
         }
204
        }
205
      }
206
    }
207
    for(let field of this.selectedFields){
208
      if((field.type == "entity" || field.type == "refine") && field.valueLabel.length > 0 && filterArray.indexOf(field.valueLabel)==-1){
209
        filterArray.push(field.valueLabel)
210
      }else if(!(field.type == "entity" || field.type == "refine")  && field.value.length > 0 && filterArray.indexOf(field.value)==-1) {
211
        filterArray.push(field.value);
212
      }
213
    }
214
    this.metaDescription+= (filterArray.length > 0?" filtered for: ":"") + filterArray.join(", ") + " ";
215
    this._meta.updateTag({content: this.metaDescription}, "name='description'");
216
    this._meta.updateTag({content: this.metaDescription}, "property='og:description'");
185 217
  }
186 218

  
187 219
  updateTitle(title: string) {
......
375 407
      }
376 408
    }
377 409
    this.filterFilterValues(this.filters);
410
    this.updateDescription();
378 411
    return filters;
379 412
  }
380 413

  

Also available in: Unified diff