import {Component, Inject, Optional} from '@angular/core'; import {Location} from '@angular/common'; import {ActivatedRoute} from '@angular/router'; import {Title, Meta} from '@angular/platform-browser'; import {RESPONSE} from "@nguniversal/express-engine/tokens"; import {SEOService} from "../sharedComponents/SEO/SEO.service"; import {properties} from "../../../environments/environment"; @Component({ selector: 'error', template: `

Bad karma: we can't find that page!

Not valid or missing {{page_type_name}} id. Search another {{page_type_name}}?

You asked for {{page}}, but despite our computers looking very hard, we could not find it. What happened ?

  • the link you clicked to arrive here has a typo in it
  • or somehow we removed that page, or gave it another name
  • or, quite unlikely for sure, maybe you typed it yourself and there was a little mistake ?
` }) export class ErrorPageComponent { public page: string; public page_type: string; public searchPage: string; public page_type_name: string; constructor (private _location: Location, private _meta: Meta, private _title: Title, private route: ActivatedRoute, @Optional() @Inject(RESPONSE) private response: any, private seoService: SEOService) { var title = "OpenAIRE | Error page"; this._meta.updateTag({content:title},"property='og:title'"); this._title.setTitle(title); this.page = _location.path(true); //this.page = _router.url; //this.page = location.href; } ngOnInit() { if(this.response) { this.response.statusCode = 404; this.response.statusMessage = '404 - Page not found'; } this.seoService.createLinkForCanonicalURL(properties.domain + properties.baseLink + "/error"); this.route.queryParams.subscribe(data => { this.page = data['page']; if (!this.page) { this.page = this._location.path(true); } this.page_type = data['page_type']; if(this.page_type) { if (this.page_type == "publication") { this.searchPage = properties.searchLinkToPublications; this.page_type_name = "publication"; } else if (this.page_type == "software") { this.searchPage = properties.searchLinkToSoftware; this.page_type_name = "software"; } else if (this.page_type == "dataset") { this.searchPage = properties.searchLinkToDatasets; this.page_type_name = "dataset"; } else if (this.page_type == "orp") { this.searchPage = properties.searchLinkToOrps; this.page_type_name = "research product"; } else if (this.page_type == "organization") { this.searchPage = properties.searchLinkToOrganizations; this.page_type_name = "organization"; } else if (this.page_type == "project") { this.searchPage = properties.searchLinkToProjects; this.page_type_name = "project"; } else if (this.page_type == "dataprovider") { this.searchPage = properties.searchLinkToDataProviders; this.page_type_name = "content provider"; } } }); } }