Revision 60872
Added by Konstantinos Triantafyllou almost 3 years ago
references.component.ts | ||
---|---|---|
1 |
import {Component} from '@angular/core'; |
|
1 |
import {Component, OnDestroy, OnInit} from '@angular/core';
|
|
2 | 2 |
import {Breadcrumb} from '../openaireLibrary/utils/breadcrumbs/breadcrumbs.component'; |
3 |
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; |
|
4 |
import {Subscription} from 'rxjs'; |
|
5 |
import {properties} from '../../environments/environment'; |
|
6 |
import {Meta, Title} from '@angular/platform-browser'; |
|
7 |
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; |
|
8 |
import {Router} from '@angular/router'; |
|
9 |
import {SEOService} from '../openaireLibrary/sharedComponents/SEO/SEO.service'; |
|
3 | 10 |
|
4 | 11 |
@Component({ |
5 | 12 |
selector: 'references', |
... | ... | |
161 | 168 |
`, |
162 | 169 |
styleUrls: ['references.component.css'] |
163 | 170 |
}) |
164 |
export class ReferencesComponent { |
|
171 |
export class ReferencesComponent implements OnInit, OnDestroy { |
|
172 |
properties: EnvProperties = properties; |
|
173 |
description = "The OpenAIRE Research Graph references"; |
|
174 |
title = "OpenAIRE - Research Graph | References"; |
|
175 |
subs: Subscription[] = []; |
|
165 | 176 |
public breadcrumbs: Breadcrumb[] = [ |
166 | 177 |
{ |
167 | 178 |
name: 'home', |
... | ... | |
175 | 186 |
name: 'References' |
176 | 187 |
} |
177 | 188 |
]; |
189 |
|
|
190 |
constructor(private _title: Title, private _piwikService:PiwikService, |
|
191 |
private _router: Router, private _meta: Meta, |
|
192 |
private seoService: SEOService) { |
|
193 |
} |
|
194 |
|
|
195 |
ngOnInit() { |
|
196 |
this._title.setTitle(this.title); |
|
197 |
this._meta.updateTag({content:this.description},"name='description'"); |
|
198 |
this._meta.updateTag({content:this.description},"property='og:description'"); |
|
199 |
this._meta.updateTag({content:this.title},"property='og:title'"); |
|
200 |
var url = this.properties.domain + this.properties.baseLink+this._router.url; |
|
201 |
this.seoService.createLinkForCanonicalURL(url, false); |
|
202 |
this._meta.updateTag({content:url},"property='og:url'"); |
|
203 |
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ |
|
204 |
this.subs.push(this._piwikService.trackView(this.properties, this.title).subscribe()); |
|
205 |
} |
|
206 |
} |
|
207 |
|
|
208 |
public ngOnDestroy() { |
|
209 |
this.subs.forEach(sub => { |
|
210 |
if(sub instanceof Subscription) { |
|
211 |
sub.unsubscribe(); |
|
212 |
} |
|
213 |
}); |
|
214 |
} |
|
178 | 215 |
} |
Also available in: Unified diff
[Graph | Trunk]: Add meta data information to new pages