diff --git a/landingPages/dataset/dataset.component.ts b/landingPages/dataset/dataset.component.ts index c5c3c78b..c4f797e6 100644 --- a/landingPages/dataset/dataset.component.ts +++ b/landingPages/dataset/dataset.component.ts @@ -1,12 +1,17 @@ -import {Component, ViewChild, ElementRef, Input} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import {DatasetService} from './dataset.service'; -import {DatasetInfo} from '../../utils/entities/datasetInfo'; -import {ActivatedRoute, Router} from '@angular/router'; -import {RouterHelper} from '../../utils/routerHelper.class'; -import { Meta} from '../../sharedComponents/metaService'; -import {PiwikService} from '../../utils/piwik/piwik.service'; -import{EnvProperties} from '../../utils/properties/env-properties'; +import {Component, ViewChild} from '@angular/core'; +import {ElementRef, Input} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Title, Meta} from '@angular/platform-browser'; + +import {Observable} from 'rxjs/Observable'; + +import {DatasetInfo} from '../../utils/entities/datasetInfo'; +import {EnvProperties} from '../../utils/properties/env-properties'; +import {RouterHelper} from '../../utils/routerHelper.class'; + +import {DatasetService} from './dataset.service'; +import {PiwikService} from '../../utils/piwik/piwik.service'; + @Component({ selector: 'dataset', @@ -14,7 +19,7 @@ import{EnvProperties} from '../../utils/properties/env-properties'; }) export class DatasetComponent { - @Input() piwikSiteId = null; + @Input() piwikSiteId = null; public datasetInfo: DatasetInfo; public datasetId : string ; @@ -53,6 +58,7 @@ export class DatasetComponent { private _piwikService:PiwikService, private route: ActivatedRoute, private _meta: Meta, + private _title: Title, private _router: Router) { } @@ -152,17 +158,17 @@ export class DatasetComponent { } private updateDescription(description:string){ - this._meta.updateMeta("description", description); - this._meta.updateProperty("og:description", description); + this._meta.updateTag({content:description},"name='description'"); + this._meta.updateTag({content:description},"property='og:description'"); } private updateTitle(title:string){ var _prefix ="OpenAIRE | "; var _title = _prefix + ((title.length> 50 ) ?title.substring(0,50):title); - this._meta.setTitle(_title ); - this._meta.updateProperty("og:title",_title); + this._title.setTitle(_title); + this._meta.updateTag({content:_title},"property='og:title'"); } private updateUrl(url:string){ - this._meta.updateProperty("og:url", url); + this._meta.updateTag({content:url},"property='og:url'"); } public buildCurationTooltip() { diff --git a/landingPages/dataset/dataset.module.ts b/landingPages/dataset/dataset.module.ts index 85540d73..a39dfbc1 100644 --- a/landingPages/dataset/dataset.module.ts +++ b/landingPages/dataset/dataset.module.ts @@ -1,42 +1,44 @@ -//import {MaterialModule} from '@angular/material'; -import { NgModule} from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; -import { SharedModule } from '../../shared/shared.module'; -import { RouterModule } from '@angular/router'; +// import {MaterialModule} from '@angular/material'; +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; +import {RouterModule} from '@angular/router'; -import { DatasetService} from './dataset.service'; -import { DatasetComponent } from './dataset.component'; -// import { DatasetRoutingModule } from './dataset-routing.module'; -import {MetricsModule} from '../landing-utils/metrics.module'; -import {IFrameModule} from '../../utils/iframe.module'; -import {AltMetricsModule} from '../../utils/altmetrics.module'; -import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module'; +import {SharedModule} from '../../shared/shared.module'; -import { ResultLandingModule } from '../landing-utils/resultLanding.module'; -import { LandingModule } from '../landing-utils/landing.module'; -import {FreeGuard} from'../../login/freeGuard.guard'; -import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; +import {DatasetComponent} from './dataset.component'; -import {MetaModule} from '../../sharedComponents/metaService.module'; -import { ConfigurationServiceModule } from '../../utils/configuration/configurationService.module'; +import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module'; +// import {DatasetRoutingModule} from './dataset-routing.module'; +import {LandingModule} from '../landing-utils/landing.module'; +import {ResultLandingModule} from '../landing-utils/resultLanding.module'; +import {MetricsModule} from '../landing-utils/metrics.module'; +import {AltMetricsModule} from '../../utils/altmetrics.module'; +import {ConfigurationServiceModule} from '../../utils/configuration/configurationService.module'; +import {IFrameModule} from '../../utils/iframe.module'; + +import {DatasetService} from './dataset.service'; + +import {FreeGuard} from'../../login/freeGuard.guard'; +import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'; @NgModule({ imports: [ //MaterialModule.forRoot(), - CommonModule, FormsModule,SharedModule, RouterModule, LandingModule, CiteThisModule, - ResultLandingModule, MetricsModule, IFrameModule, AltMetricsModule, - MetaModule, ConfigurationServiceModule + CommonModule, FormsModule, SharedModule, RouterModule, LandingModule, + CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule, + AltMetricsModule, ConfigurationServiceModule ], declarations: [ - DatasetComponent + DatasetComponent ], providers:[ DatasetService, FreeGuard, IsRouteEnabled - ], + ], exports: [ - DatasetComponent - ] + DatasetComponent + ] }) + export class DatasetModule { }