From 0348364b138d22e49942f14adb10149dd0bddab7 Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Wed, 22 Mar 2017 10:31:40 +0000 Subject: [PATCH] SEO meta tags & title for each page | footer menu | cookies law message | entity auto complete | change deposit & claims urls to look alike production (participate/*) git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@46415 d315682c-612b-4755-9ff5-7f18f6832af3 --- portal-2/src/angular2-meta.ts | 32 +++- portal-2/src/app/app-routing.module.ts | 29 ++-- portal-2/src/app/app.component.ts | 11 +- portal-2/src/app/app.module.ts | 5 +- .../claimsAdmin/claimsAdmin.component.ts | 2 +- .../app/claims/myClaims/myClaims.component.ts | 2 +- portal-2/src/app/deposit/deposit.component.ts | 20 ++- .../app/deposit/depositResult.component.ts | 19 ++- .../dataProvider/dataProvider.component.ts | 19 ++- .../dataset/dataset.component.html | 4 +- .../landingPages/dataset/dataset.component.ts | 18 ++- .../organization/organization.component.ts | 20 ++- .../landingPages/person/person.component.ts | 20 ++- .../project/project.component.html | 4 +- .../landingPages/project/project.component.ts | 19 ++- .../publication/publication.component.html | 6 +- .../publication/publication.component.ts | 24 ++- .../app/searchPages/find/search.component.ts | 11 +- .../advancedSearchPage.component.ts | 16 +- .../searchUtils/searchPage.component.ts | 19 ++- .../simple/searchDataproviders.component.ts | 6 +- .../simple/searchDatasets.component.ts | 6 +- .../simple/searchOrganizations.component.ts | 6 +- .../simple/searchPeople.component.ts | 6 +- .../simple/searchProjects.component.ts | 6 +- .../simple/searchPublications.component.ts | 6 +- .../app/sharedComponents/bottom.component.ts | 107 ++++--------- .../cookie-law/cookie-law.component.ts | 146 ++++++++++++++++++ .../cookie-law/cookie-law.css | 77 +++++++++ .../cookie-law/cookie-law.html | 21 +++ .../cookie-law/cookie-law.module.ts | 25 +++ .../cookie-law/cookie-law.service.ts | 57 +++++++ .../app/sharedComponents/cookie-law/icons.ts | 13 ++ .../navigationBar.component.ts | 100 ++++++------ .../entitiesAutoComplete.component.ts | 12 +- .../entitySearch.service.ts | 30 +++- .../utils/metaTags/openaireMetaTags.class.ts | 18 +++ portal-2/src/assets/sitemap.xml | 103 ++++++++++++ portal-2/src/browser.module.ts | 6 +- portal-2/src/index.html | 21 ++- portal-2/src/server.routes.ts | 4 +- 41 files changed, 852 insertions(+), 224 deletions(-) create mode 100644 portal-2/src/app/sharedComponents/cookie-law/cookie-law.component.ts create mode 100644 portal-2/src/app/sharedComponents/cookie-law/cookie-law.css create mode 100644 portal-2/src/app/sharedComponents/cookie-law/cookie-law.html create mode 100644 portal-2/src/app/sharedComponents/cookie-law/cookie-law.module.ts create mode 100644 portal-2/src/app/sharedComponents/cookie-law/cookie-law.service.ts create mode 100644 portal-2/src/app/sharedComponents/cookie-law/icons.ts create mode 100644 portal-2/src/app/utils/metaTags/openaireMetaTags.class.ts create mode 100644 portal-2/src/assets/sitemap.xml diff --git a/portal-2/src/angular2-meta.ts b/portal-2/src/angular2-meta.ts index f961d9e4..5f4f48e3 100644 --- a/portal-2/src/angular2-meta.ts +++ b/portal-2/src/angular2-meta.ts @@ -6,10 +6,10 @@ * found in the LICENSE file at https://angular.io/license */ -import {Injectable} from '@angular/core'; +import {Injectable, Inject} from '@angular/core'; // es6-modules are used here import {DomAdapter, getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; - +import {DOCUMENT} from '@angular/platform-browser'; /** * Represent meta element. * @@ -54,7 +54,13 @@ export interface MetaDefinition { @Injectable() export class Meta { private _dom: DomAdapter = getDOM(); - + constructor( @Inject(DOCUMENT) private _document: any) { } + /** + * Sets the title of the page + */ + setTitle(title: string) { + this._document.title = title + } /** * Adds a new meta tag to the dom. * @@ -119,6 +125,19 @@ export class Meta { return this._prepareMetaElement(tag, meta); } + updateMeta(name, content) { + const head = this._document.head; + let childNodesAsList = this._dom.childNodesAsList(head); + let metaEl = childNodesAsList.find(el => el['attribs'] ? el['attribs'].name == name : false); + if (metaEl) metaEl['attribs'].content = content; + } + updateProperty(property, content) { + const head = this._document.head; + let childNodesAsList = this._dom.childNodesAsList(head); + let metaEl = childNodesAsList.find(el => el['attribs'] ? el['attribs'].property == property : false); + if (metaEl) metaEl['attribs'].content = content; + } + /** * Removes meta tag with the given selector from the dom. * @@ -168,11 +187,14 @@ export class Meta { return el; } + // private _appendMetaElement(meta: HTMLMetaElement): void { + // const head = this._dom.getElementsByTagName(this._dom.defaultDoc(), 'head')[0]; + // this._dom.appendChild(head, meta); + // } private _appendMetaElement(meta: HTMLMetaElement): void { - const head = this._dom.getElementsByTagName(this._dom.defaultDoc(), 'head')[0]; + const head = this._document.head; this._dom.appendChild(head, meta); } - private _removeMetaElement(meta: HTMLMetaElement): void { const head = this._dom.parentElement(meta); this._dom.removeChild(head, meta); diff --git a/portal-2/src/app/app-routing.module.ts b/portal-2/src/app/app-routing.module.ts index 83866a12..cf75438a 100644 --- a/portal-2/src/app/app-routing.module.ts +++ b/portal-2/src/app/app-routing.module.ts @@ -126,25 +126,36 @@ export function getBulkLinkingModule() { @NgModule({ imports: [ RouterModule.forChild([ - { path: '', redirectTo: '/search/find', pathMatch: 'full' }, + { path: '', redirectTo: '/search/find', pathMatch: 'full' }, { path: 'search/publication', loadChildren: getPublicationModule }, { path: 'search/dataset', loadChildren: getDatasetModule }, { path: 'search/person', loadChildren: getPersonModule }, { path: 'search/organization', loadChildren: getOrganizationModule }, { path: 'search/project', loadChildren: getProjectModule }, { path: 'search/dataprovider', loadChildren: getDataProviderModule }, - { path: 'deposit-datasets', loadChildren: getDepositDatasetsModule }, - { path: 'deposit-datasets-result', loadChildren: getDepositDatasetsResultsModule }, - { path: 'deposit-publications', loadChildren: getDepositPublicationsModule }, - { path: 'deposit-publications-result', loadChildren: getDepositPublicationsResultsModule }, - { path: 'search/find', loadChildren: getMainSearchModule }, + { path: 'participate/deposit-datasets', loadChildren: getDepositDatasetsModule }, + { path: 'participate/deposit-datasets-result', loadChildren: getDepositDatasetsResultsModule }, + { path: 'participate/deposit-publications', loadChildren: getDepositPublicationsModule }, + { path: 'participate/deposit-publications-result', loadChildren: getDepositPublicationsResultsModule }, + { path: 'search/find', loadChildren: getMainSearchModule , data: { + meta: { + title: 'Home page', + description: 'Description of the home page' + } + }}, { path: 'search/find/publications', loadChildren: getSearchPublicationsModule }, { path: 'search/find/datasets', loadChildren: getSearchDatasetsModule }, { path: 'search/find/projects', loadChildren: getSearchProjectsModule }, { path: 'search/find/dataproviders', loadChildren: getSearchDataProvidersModule }, { path: 'search/find/organizations', loadChildren: getSearchOrganizationsModule }, { path: 'search/find/people', loadChildren: getSearchPeopleModule }, - { path: 'search/data-providers', loadChildren: getCompatibleDataProvidersModule }, + { path: 'search/data-providers', loadChildren: getCompatibleDataProvidersModule, + data: { + meta: { + title: 'Home page', + description: 'Description of the home page' + } + }}, { path: 'search/entity-registries', loadChildren: getEntityRegistriesModule }, { path: 'search/advanced/publications', loadChildren: getAdvancedSearchPublicationsModule }, { path: 'search/advanced/datasets', loadChildren: getAdvancedSearchDatasetsModule }, @@ -155,8 +166,8 @@ export function getBulkLinkingModule() { { path: 'project-report', loadChildren: gethtmlProjectReportModule }, // { path: 'myclaims', loadChildren: getMyClaimsModule }, // { path: 'claims', loadChildren: getClaimsAdminModule }, - // { path: 'bulk-linking', loadChildren: getBulkLinkingModule }, - // { path: 'linking', loadChildren: getLinkingModule }, + // { path: 'participate/bulk-claim', loadChildren: getBulkLinkingModule }, + // { path: 'participate/claim', loadChildren: getLinkingModule }, ]) ], }) diff --git a/portal-2/src/app/app.component.ts b/portal-2/src/app/app.component.ts index 8e2dce77..fde6260d 100644 --- a/portal-2/src/app/app.component.ts +++ b/portal-2/src/app/app.component.ts @@ -29,10 +29,10 @@ export class XLargeDirective { -
+
-
+
@@ -51,7 +51,12 @@ export class XLargeDirective {
- + + OpenAIRE uses cookies in order to function properly.
+ Cookies are small pieces of data that websites store in your browser to allow us to give you the best browsing experience possible. + By using the OpenAIRE portal you accept our use of cookies. Read more +
+ ` diff --git a/portal-2/src/app/app.module.ts b/portal-2/src/app/app.module.ts index 63b94bb5..55414537 100755 --- a/portal-2/src/app/app.module.ts +++ b/portal-2/src/app/app.module.ts @@ -10,7 +10,7 @@ import { AppComponent, XLargeDirective } from './app.component'; import {SharedComponentsModule} from './sharedComponents/sharedComponents.module'; //navbar import { ErrorModule } from './error/error.module'; import { CacheService } from './shared/cache.service'; - +import { CookieLawModule } from './sharedComponents/cookie-law/cookie-law.module'; @NgModule({ declarations: [ AppComponent, XLargeDirective ], @@ -19,7 +19,8 @@ import { CacheService } from './shared/cache.service'; SharedComponentsModule, AppRoutingModule, - ErrorModule + ErrorModule, + CookieLawModule ], exports:[], providers:[CacheService] }) export class AppModule { diff --git a/portal-2/src/app/claims/claimsAdmin/claimsAdmin.component.ts b/portal-2/src/app/claims/claimsAdmin/claimsAdmin.component.ts index 281cf824..06717a09 100644 --- a/portal-2/src/app/claims/claimsAdmin/claimsAdmin.component.ts +++ b/portal-2/src/app/claims/claimsAdmin/claimsAdmin.component.ts @@ -10,7 +10,7 @@ import {Observable} from 'rxjs/Observable';

Claims Administrator

- +
diff --git a/portal-2/src/app/claims/myClaims/myClaims.component.ts b/portal-2/src/app/claims/myClaims/myClaims.component.ts index 305d70a9..d5e6c13e 100644 --- a/portal-2/src/app/claims/myClaims/myClaims.component.ts +++ b/portal-2/src/app/claims/myClaims/myClaims.component.ts @@ -11,7 +11,7 @@ import {Observable} from 'rxjs/Observable';

My Linked research resutls

- +
diff --git a/portal-2/src/app/deposit/deposit.component.ts b/portal-2/src/app/deposit/deposit.component.ts index 0eec5bc4..82cd98e1 100644 --- a/portal-2/src/app/deposit/deposit.component.ts +++ b/portal-2/src/app/deposit/deposit.component.ts @@ -2,6 +2,7 @@ import {Component, Input} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import { Router } from '@angular/router'; import {OpenaireProperties, ErrorCodes} from '../utils/properties/openaireProperties'; +import { Meta} from '../../angular2-meta'; @Component({ @@ -63,7 +64,7 @@ export class DepositComponent { public selectedId: string = ""; public warningMessage: string = ""; - constructor (private _router: Router) { + constructor (private _router: Router, private _meta: Meta) { this.openAccess = OpenaireProperties.getOpenAccess(); this.openAccessRepo = OpenaireProperties.getOpenAccessRepo(); @@ -71,17 +72,28 @@ export class DepositComponent { this.h2020Guidlines = OpenaireProperties.getH2020Guidlines(); this.ercGuidlines = OpenaireProperties.getERCGuidlines(); this.helpdesk = OpenaireProperties.getHelpdesk(); + this.updateTitle("Deposit "+this.requestFor); + this.updateDescription("Openaire, repositories, open access, data provider, compatibility, organization, deposit "+ this.requestFor); + } + updateDescription(description:string){ + this._meta.updateMeta("description", description); + this._meta.updateMeta("og:description", description); + } + updateTitle(title:string){ + var _suffix ="| OpenAIRE"; + var _title = ((title.length> 50 ) ?title.substring(0,50):title) + _suffix; + this._meta.setTitle(_title ); + this._meta.updateMeta("og:title",_title); } - organizationSelected(id: string) { console.info("organization selected"); if(id && id.length > 0){ if(this.requestFor == "Publications") { - this._router.navigate( ['deposit-publications-result'], { queryParams: { "organizationId": id } } ); + this._router.navigate( ['participate/deposit-publications-result'], { queryParams: { "organizationId": id } } ); } else if(this.requestFor == "Research Data") { - this._router.navigate( ['deposit-datasets-result'], { queryParams: { "organizationId": id } } ); + this._router.navigate( ['participate/deposit-datasets-result'], { queryParams: { "organizationId": id } } ); } } else { this.warningMessage = "No organization selected"; diff --git a/portal-2/src/app/deposit/depositResult.component.ts b/portal-2/src/app/deposit/depositResult.component.ts index ef4a8f92..360d2b66 100644 --- a/portal-2/src/app/deposit/depositResult.component.ts +++ b/portal-2/src/app/deposit/depositResult.component.ts @@ -7,6 +7,7 @@ import { FetchDataproviders } from '../utils/fetchEntitiesClasses/fetchDataprovi import { SearchDataprovidersService } from '../services/searchDataproviders.service'; import {OrganizationService} from '../services/organization.service'; +import { Meta} from '../../angular2-meta'; import {RouterHelper} from '../utils/routerHelper.class'; @@ -112,15 +113,27 @@ export class DepositResultComponent { constructor (private _router: Router, private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService, - private _organizationService: OrganizationService) { + private _organizationService: OrganizationService, private _meta: Meta) { console.info("depositResult constructor"); this.zenodo = OpenaireProperties.getZenodoURL(); this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService); this.status = this.errorCodes.LOADING; - console.info("loading"); - } + this.updateTitle("Deposit "+this.requestFor); + this.updateDescription("Openaire, repositories, open access, data provider, compatibility, organization, deposit "+ this.requestFor); + } + updateDescription(description:string){ + this._meta.updateMeta("description", description); + this._meta.updateMeta("og:description", description); + } + updateTitle(title:string){ + var _suffix ="| OpenAIRE"; + var _title = ((title.length> 50 ) ?title.substring(0,50):title) + _suffix; + this._meta.setTitle(_title ); + this._meta.updateMeta("og:title",_title); + } + ngOnInit() { console.info('depositResult init'); diff --git a/portal-2/src/app/landingPages/dataProvider/dataProvider.component.ts b/portal-2/src/app/landingPages/dataProvider/dataProvider.component.ts index 6d7643b3..8be87f51 100644 --- a/portal-2/src/app/landingPages/dataProvider/dataProvider.component.ts +++ b/portal-2/src/app/landingPages/dataProvider/dataProvider.component.ts @@ -3,9 +3,9 @@ import {Observable} from 'rxjs/Observable'; import {DataProviderService} from './dataProvider.service'; import {DataProviderInfo} from '../../utils/entities/dataProviderInfo'; import {ActivatedRoute} from '@angular/router'; +import { Meta} from '../../../angular2-meta'; import{TabsComponent} from './tabs.component'; - @Component({ selector: 'dataprovider', templateUrl: 'dataProvider.component.html', @@ -14,8 +14,9 @@ import{TabsComponent} from './tabs.component'; }) export class DataProviderComponent { - constructor (private _dataproviderService: DataProviderService, private route: ActivatedRoute) { - + constructor (private _dataproviderService: DataProviderService, private route: ActivatedRoute, private _meta: Meta) { + this.updateTitle("Data provider"); + this.updateDescription("Data provider, search, repositories, open access"); } ngOnInit() { this.sub = this.route.queryParams.subscribe(data => { @@ -63,6 +64,8 @@ export class DataProviderComponent { this._dataproviderService.getDataproviderInfo(this.datasourceId).subscribe( data => { this.dataProviderInfo = data; + this.updateTitle(this.dataProviderInfo.title.name); + this.updateDescription("Data provider, search, repositories, open access,"+this.dataProviderInfo.title.name); // console.info(this.dataProviderInfo.resultsBy); }, err => { @@ -73,4 +76,14 @@ export class DataProviderComponent { ); } } + updateDescription(description:string){ + this._meta.updateMeta("description", description); + this._meta.updateMeta("og:description", description); + } + updateTitle(title:string){ + var _suffix ="| OpenAIRE"; + var _title = ((title.length> 50 ) ?title.substring(0,50):title) + _suffix; + this._meta.setTitle(_title ); + this._meta.updateMeta("og:title",_title); + } } diff --git a/portal-2/src/app/landingPages/dataset/dataset.component.html b/portal-2/src/app/landingPages/dataset/dataset.component.html index eda7d830..9971a75a 100644 --- a/portal-2/src/app/landingPages/dataset/dataset.component.html +++ b/portal-2/src/app/landingPages/dataset/dataset.component.html @@ -205,7 +205,7 @@ - +
View less @@ -235,7 +235,7 @@ : {{item['labelConcept']}}
- + diff --git a/portal-2/src/app/landingPages/dataset/dataset.component.ts b/portal-2/src/app/landingPages/dataset/dataset.component.ts index e52157a2..29b846da 100644 --- a/portal-2/src/app/landingPages/dataset/dataset.component.ts +++ b/portal-2/src/app/landingPages/dataset/dataset.component.ts @@ -5,6 +5,7 @@ import {DatasetInfo} from '../../utils/entities/datasetInfo'; import {ActivatedRoute} from '@angular/router'; import {OpenaireProperties} from '../../utils/properties/openaireProperties' import {RouterHelper} from '../../utils/routerHelper.class'; +import { Meta} from '../../../angular2-meta'; @Component({ selector: 'dataset', @@ -38,12 +39,14 @@ export class DatasetComponent { public errorMessage = ""; public routerHelper:RouterHelper = new RouterHelper(); - constructor (private _datasetService: DatasetService, private route: ActivatedRoute) {} + constructor (private _datasetService: DatasetService, private route: ActivatedRoute, private _meta: Meta) {} ngOnInit() { this.sub = this.route.queryParams.subscribe(params => { this.datasetId = params['datasetId']; console.info("Id is :"+this.datasetId); + this.updateTitle("Dataset"); + this.updateDescription("Dataset, search, open access"); if(this.datasetId){ this.getDatasetInfo(this.datasetId); }else{ @@ -68,7 +71,8 @@ export class DatasetComponent { this._datasetService.getDatasetInfo(id).subscribe( data => { this.datasetInfo = data; - + this.updateTitle(this.datasetInfo.title.name); + this.updateDescription("Dataset, search, repositories, open access,"+this.datasetInfo.title.name); this.result = [] this.result = {id: id, type :"dataset", source : "openaire", title: this.datasetInfo.title,url: '', result: '', accessRights: this.datasetInfo.bestlicense, embargoEndDate: ''}; @@ -97,4 +101,14 @@ export class DatasetComponent { this.totalViews = $event.totalViews; this.totalDownloads = $event.totalDownloads; } + updateDescription(description:string){ + this._meta.updateMeta("description", description); + this._meta.updateMeta("og:description", description); + } + updateTitle(title:string){ + var _suffix ="| OpenAIRE"; + var _title = ((title.length> 50 ) ?title.substring(0,50):title) + _suffix; + this._meta.setTitle(_title ); + this._meta.updateMeta("og:title",_title); + } } diff --git a/portal-2/src/app/landingPages/organization/organization.component.ts b/portal-2/src/app/landingPages/organization/organization.component.ts index 3024c78a..231460b1 100644 --- a/portal-2/src/app/landingPages/organization/organization.component.ts +++ b/portal-2/src/app/landingPages/organization/organization.component.ts @@ -9,7 +9,7 @@ import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataprov import {SearchPublicationsService} from '../../services/searchPublications.service'; import {SearchDataprovidersService} from '../../services/searchDataproviders.service'; import {SearchProjectsService} from '../../services/searchProjects.service'; - +import { Meta} from '../../../angular2-meta'; import {OpenaireProperties} from '../../utils/properties/openaireProperties'; import {SearchingProjectsTabComponent} from '../searchingProjectsInTab.component'; import {RouterHelper} from '../../utils/routerHelper.class'; @@ -61,8 +61,9 @@ export class OrganizationComponent { private _searchDataprovidersService: SearchDataprovidersService, private _reportsService: ReportsService, private _searchPublicationsService: SearchPublicationsService, - private _searchProjectsService: SearchProjectsService) { - + private _searchProjectsService: SearchProjectsService, private _meta: Meta) { + this.updateTitle("Organization"); + this.updateDescription("Organization, country, projects, search, repositories, open access"); console.info('organization constructor'); this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService); } @@ -119,7 +120,8 @@ export class OrganizationComponent { this.errorMessage = 'No organization found'; } else { this.organizationInfo = data; - + this.updateTitle(this.organizationInfo.title.name); + this.updateDescription("Organization, country, projects, search, repositories, open access"+this.organizationInfo.title.name); let projectsNum = 0; if(this.organizationInfo.projects != undefined) { this.fundersSet = new Set(); @@ -315,6 +317,16 @@ export class OrganizationComponent { // error => console.log("Error getting number of publications for project.")); // }//); } + updateDescription(description:string){ + this._meta.updateMeta("description", description); + this._meta.updateMeta("og:description", description); + } + updateTitle(title:string){ + var _suffix ="| OpenAIRE"; + var _title = ((title.length> 50 ) ?title.substring(0,50):title) + _suffix; + this._meta.setTitle(_title ); + this._meta.updateMeta("og:title",_title); + } public openLoading(){ if(this.loading){ diff --git a/portal-2/src/app/landingPages/person/person.component.ts b/portal-2/src/app/landingPages/person/person.component.ts index 0da71625..3074d986 100644 --- a/portal-2/src/app/landingPages/person/person.component.ts +++ b/portal-2/src/app/landingPages/person/person.component.ts @@ -10,6 +10,7 @@ import { FetchDatasets } from '../../utils/fetchEntitiesClasses/fetchDatasets.cl import { SearchDatasetsService } from '../../services/searchDatasets.service'; import {OpenaireProperties} from '../../utils/properties/openaireProperties'; +import { Meta} from '../../../angular2-meta'; @Component({ selector: 'person', @@ -35,7 +36,10 @@ export class PersonComponent { constructor (private _personService: PersonService, private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService, - private _searchDatasetsService: SearchDatasetsService) { + private _searchDatasetsService: SearchDatasetsService, private _meta: Meta) { + this.updateTitle("Person"); + this.updateDescription("person, publication, research data, search, open access"); + console.info('person constructor'); this.fetchPublications = new FetchPublications( this._searchPublicationsService); this.fetchDatasets = new FetchDatasets( this._searchDatasetsService); @@ -49,7 +53,7 @@ export class PersonComponent { if(this.personId){ this.fetchPersonInfo(); this.searchPublications(); - + }else{ this.warningMessage="No valid person id"; } @@ -97,6 +101,8 @@ export class PersonComponent { this._personService.getPersonInfo(this.personId).subscribe( data => { this.personInfo = data; + this.updateTitle(this.personInfo.fullname); + this.updateDescription("person, publication, research data, search, open access, "+this.personInfo.fullname); }, err => { @@ -117,4 +123,14 @@ export class PersonComponent { this.fetchDatasets.getResultsForEntity("person", this.personId, 1, 10); this.linkToSearchDatasets = OpenaireProperties.getLinkToAdvancedSearchDatasets();// + "?person=" + this.personId + "&pe=and"; } + updateDescription(description:string){ + this._meta.updateMeta("description", description); + this._meta.updateMeta("og:description", description); + } + updateTitle(title:string){ + var _suffix ="| OpenAIRE"; + var _title = ((title.length> 50 ) ?title.substring(0,50):title) + _suffix; + this._meta.setTitle(_title ); + this._meta.updateMeta("og:title",_title); + } } diff --git a/portal-2/src/app/landingPages/project/project.component.html b/portal-2/src/app/landingPages/project/project.component.html index 55621e76..9139c059 100644 --- a/portal-2/src/app/landingPages/project/project.component.html +++ b/portal-2/src/app/landingPages/project/project.component.html @@ -234,12 +234,12 @@
  • - + Deposit Publications
  • diff --git a/portal-2/src/app/landingPages/project/project.component.ts b/portal-2/src/app/landingPages/project/project.component.ts index 89ebba50..be4f3b1b 100644 --- a/portal-2/src/app/landingPages/project/project.component.ts +++ b/portal-2/src/app/landingPages/project/project.component.ts @@ -14,6 +14,8 @@ import {ModalLoading} from '../../utils/modal/loading.component'; import {ReportsService} from '../../services/reports.service'; import {OpenaireProperties} from '../../utils/properties/openaireProperties'; +import { Meta} from '../../../angular2-meta'; + @Component({ selector: 'project', @@ -62,11 +64,13 @@ export class ProjectComponent{ private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService, private _searchDatasetsService: SearchDatasetsService, - private _reportsService: ReportsService) { + private _reportsService: ReportsService, private _meta: Meta) { console.info('project constructor.'); this.fetchPublications = new FetchPublications( this._searchPublicationsService); this.fetchDatasets = new FetchDatasets(this._searchDatasetsService); + this.updateTitle("Project"); + this.updateDescription("project, funding, open access, publications, datasets, "); } ngOnInit() { @@ -166,6 +170,8 @@ export class ProjectComponent{ if(this.projectName == undefined || this.projectName == '') { this.projectName = this.projectInfo.title; } + this.updateTitle(this.projectName); + this.updateDescription("project, funding, open access, publications, datasets, "+this.projectName+ ","+this.projectInfo.funder); this.project= { funderId: "", funderName: this.projectInfo.funder, projectId: this.projectId, projectName: this.projectInfo.title, projectAcronym: this.projectInfo.acronym, startDate: this.projectInfo.startDate, endDate: this.projectInfo.endDate }; this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"projViewsTimeline","projTitle":"'+this.projectId+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true'; @@ -236,6 +242,17 @@ export class ProjectComponent{ this.totalViews = $event.totalViews; this.totalDownloads = $event.totalDownloads; } + updateDescription(description:string){ + this._meta.updateMeta("description", description); + this._meta.updateMeta("og:description", description); + } + updateTitle(title:string){ + var _suffix ="| OpenAIRE"; + var _title = ((title.length> 50 ) ?title.substring(0,50):title) + _suffix; + this._meta.setTitle(_title ); + this._meta.updateMeta("og:title",_title); + } + public openLoading(){ if(this.loading){ diff --git a/portal-2/src/app/landingPages/publication/publication.component.html b/portal-2/src/app/landingPages/publication/publication.component.html index 1c3d2103..e6974302 100644 --- a/portal-2/src/app/landingPages/publication/publication.component.html +++ b/portal-2/src/app/landingPages/publication/publication.component.html @@ -57,7 +57,7 @@