2020-10-08 17:52:05 +02:00
|
|
|
import {Component, OnInit} from '@angular/core';
|
2020-11-16 13:56:17 +01:00
|
|
|
import {Meta, Title} from '@angular/platform-browser';
|
2020-10-08 17:52:05 +02:00
|
|
|
import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
|
2020-11-16 13:56:17 +01:00
|
|
|
import {ActivatedRoute, Router} from '@angular/router';
|
|
|
|
import {properties} from '../../environments/environment';
|
|
|
|
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
|
|
|
|
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
|
|
|
|
import {SEOService} from '../openaireLibrary/sharedComponents/SEO/SEO.service';
|
|
|
|
import {Subscription} from 'rxjs';
|
2020-10-05 18:36:30 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'resources',
|
|
|
|
templateUrl: 'resources.component.html',
|
|
|
|
styleUrls: ['resources.component.css'],
|
|
|
|
})
|
|
|
|
export class ResourcesComponent implements OnInit {
|
2020-11-16 13:56:17 +01:00
|
|
|
properties:EnvProperties;
|
|
|
|
subs: Subscription[] = [];
|
|
|
|
description = "Start building with OpenAIRE APIs. How to access the graph? XML Metadata schema and documentation.";
|
|
|
|
title = "OpenAIRE - Research Graph | Resources";
|
2020-10-08 17:52:05 +02:00
|
|
|
public breadcrumbs: Breadcrumb[] = [
|
|
|
|
{
|
|
|
|
name: 'home',
|
|
|
|
route: '/'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'resources'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2020-11-16 13:56:17 +01:00
|
|
|
constructor(private _title: Title, private route: ActivatedRoute, private _router: Router,
|
|
|
|
private _piwikService:PiwikService,
|
|
|
|
private _meta: Meta, private seoService: SEOService) {
|
2020-10-05 18:36:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
2020-11-16 13:56:17 +01:00
|
|
|
this.properties = properties;
|
|
|
|
this._title.setTitle(this.title);
|
|
|
|
this._meta.updateTag({content:this.description},"name='description'");
|
|
|
|
this._meta.updateTag({content:this.description},"property='og:description'");
|
|
|
|
this._meta.updateTag({content:this.title},"property='og:title'");
|
|
|
|
var url = this.properties.domain + this.properties.baseLink+this._router.url;
|
|
|
|
this.seoService.createLinkForCanonicalURL(url, false);
|
|
|
|
this._meta.updateTag({content:url},"property='og:url'");
|
|
|
|
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
|
|
|
|
this.subs.push(this._piwikService.trackView(this.properties, this.title).subscribe());
|
|
|
|
}
|
2020-10-09 11:35:22 +02:00
|
|
|
}
|
2021-04-13 00:21:12 +02:00
|
|
|
|
2020-11-16 13:56:17 +01:00
|
|
|
public ngOnDestroy() {
|
|
|
|
for (let sub of this.subs) {
|
|
|
|
sub.unsubscribe();
|
|
|
|
}
|
|
|
|
}
|
2020-10-05 18:36:30 +02:00
|
|
|
}
|