diff --git a/explore/src/app/fos/fos.component.html b/explore/src/app/fos/fos.component.html index 62edfbfd..3c729e5b 100644 --- a/explore/src/app/fos/fos.component.html +++ b/explore/src/app/fos/fos.component.html @@ -1,4 +1,4 @@ - +
diff --git a/explore/src/app/fos/fos.component.ts b/explore/src/app/fos/fos.component.ts index b3c6c778..3809e982 100644 --- a/explore/src/app/fos/fos.component.ts +++ b/explore/src/app/fos/fos.component.ts @@ -6,7 +6,8 @@ import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.compo import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties"; import {properties} from "src/environments/environment"; import {FormBuilder, FormControl} from "@angular/forms"; -import {ActivatedRoute} from "@angular/router"; +import {ActivatedRoute, Router} from "@angular/router"; +import {Meta, Title} from "@angular/platform-browser"; import {Location} from "@angular/common"; import {StringUtils} from "../openaireLibrary/utils/string-utils.class"; @@ -16,6 +17,9 @@ import {StringUtils} from "../openaireLibrary/utils/string-utils.class"; styleUrls: ['fos.component.css'] }) export class FosComponent implements OnInit, OnDestroy { + public url: string = null; + public pageTitle: string = "OpenAIRE | Fields of Science"; + public pageDescription: string = "We have integrated a Field-of-Science (FoS) taxonomy into our dataset to organize and discover research more effectively. Using the full capabilities of the OpenAIRE Research Graph (full-texts, citations, references, venues) we apply AI and bring forward any multidisciplinarity potential."; public fos: any[] = []; public fosOptions: string[] = []; @@ -38,9 +42,16 @@ export class FosComponent implements OnInit, OnDestroy { private fb: FormBuilder, private location: Location, private route: ActivatedRoute, + private _router: Router, + private _meta: Meta, + private _title: Title ) {} ngOnInit() { + this.url = this.properties.domain + this.properties.baseLink + this._router.url; + this.updateUrl(this.url); + this.updateTitle(this.pageTitle); + this.updateDescription(this.pageDescription); this.keywordControl = this.fb.control(''); this.httpClient.get(properties.domain+'/assets/vocabulary/fos.json').subscribe(data => { this.fos = data['fos']; @@ -139,5 +150,20 @@ export class FosComponent implements OnInit, OnDestroy { public urlEncodeAndQuote(str: string): string { return StringUtils.quote(StringUtils.URIEncode(str)); + } + + private updateUrl(url: string) { + this._meta.updateTag({content: url}, "property='og:url'"); + } + + private updateTitle(title: string) { + var _title = ((title.length > 50) ? title.substring(0, 50) : title); + this._title.setTitle(_title); + this._meta.updateTag({content: _title}, "property='og:title'"); + } + + private updateDescription(description: string) { + this._meta.updateTag({content: description}, "name='description'"); + this._meta.updateTag({content: description}, "property='og:description'"); } } \ No newline at end of file diff --git a/explore/src/app/fos/fos.module.ts b/explore/src/app/fos/fos.module.ts index 2673f856..85140bf2 100644 --- a/explore/src/app/fos/fos.module.ts +++ b/explore/src/app/fos/fos.module.ts @@ -3,18 +3,19 @@ import {NgModule} from "@angular/core"; import {FormsModule} from "@angular/forms"; import {RouterModule} from "@angular/router"; import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; +import {IconsModule} from "../openaireLibrary/utils/icons/icons.module"; import {BreadcrumbsModule} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.module"; +import {Schema2jsonldModule} from "../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module"; +import {SearchInputModule} from "../openaireLibrary/sharedComponents/search-input/search-input.module"; import {FosRoutingModule} from './fos-routing.module'; import {FosComponent} from './fos.component'; -import {IconsModule} from "../openaireLibrary/utils/icons/icons.module"; -import {SearchInputModule} from "../openaireLibrary/sharedComponents/search-input/search-input.module"; @NgModule({ imports: [ CommonModule, FormsModule, RouterModule, FosRoutingModule, BreadcrumbsModule, IconsModule, - SearchInputModule + SearchInputModule, Schema2jsonldModule ], declarations: [ FosComponent diff --git a/explore/src/app/openaireLibrary b/explore/src/app/openaireLibrary index fff6dffd..0c4df8a3 160000 --- a/explore/src/app/openaireLibrary +++ b/explore/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit fff6dffd8871615e2bccfcda9b6ff025e79f5d80 +Subproject commit 0c4df8a34dd4f518353c5924238eca9d2cf0a91e diff --git a/explore/src/app/sdg/sdg.component.html b/explore/src/app/sdg/sdg.component.html index 67624514..5a6633d5 100644 --- a/explore/src/app/sdg/sdg.component.html +++ b/explore/src/app/sdg/sdg.component.html @@ -1,4 +1,4 @@ - +
diff --git a/explore/src/app/sdg/sdg.component.ts b/explore/src/app/sdg/sdg.component.ts index 6e9f7980..f40a8244 100644 --- a/explore/src/app/sdg/sdg.component.ts +++ b/explore/src/app/sdg/sdg.component.ts @@ -8,6 +8,8 @@ import {properties} from "src/environments/environment"; import {RefineFieldResultsService} from "../openaireLibrary/services/refineFieldResults.service"; import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields"; import {StringUtils} from "../openaireLibrary/utils/string-utils.class"; +import {Router} from '@angular/router'; +import {Meta, Title} from "@angular/platform-browser"; @Component({ selector: 'sdg', @@ -15,6 +17,9 @@ import {StringUtils} from "../openaireLibrary/utils/string-utils.class"; styleUrls: ['sdg.component.css'] }) export class SdgComponent implements OnInit, OnDestroy { + public url: string = null; + public pageTitle: string = "OpenAIRE | Sustainable Development Goals"; + public pageDescription: string = "Laying the foundation for new approaches and solutions. We have developed a classification scheme for UN Sustainable Development Goals, to view contributions of research towards complex challenges for humanity such as climate change, biodiversity loss, pollution and poverty reduction."; private sdgs: any = []; private sdgsResearchOutcomes: any = []; @@ -28,11 +33,18 @@ export class SdgComponent implements OnInit, OnDestroy { subscriptions: Subscription[] = []; constructor( - private httpClient: HttpClient, private refineFieldResultsService: RefineFieldResultsService + private httpClient: HttpClient, private refineFieldResultsService: RefineFieldResultsService, + private _router: Router, + private _meta: Meta, + private _title: Title ) {} ngOnInit() { this.loading = true; + this.url = this.properties.domain + this.properties.baseLink + this._router.url; + this.updateUrl(this.url); + this.updateTitle(this.pageTitle); + this.updateDescription(this.pageDescription); this.httpClient.get(properties.domain+'/assets/vocabulary/sdg.json').subscribe(data => { this.sdgs = data['sdg']; }); @@ -58,5 +70,20 @@ export class SdgComponent implements OnInit, OnDestroy { public urlEncodeAndQuote(str: string): string { return StringUtils.quote(StringUtils.URIEncode(str)); + } + + private updateUrl(url: string) { + this._meta.updateTag({content: url}, "property='og:url'"); + } + + private updateTitle(title: string) { + var _title = ((title.length > 50) ? title.substring(0, 50) : title); + this._title.setTitle(_title); + this._meta.updateTag({content: _title}, "property='og:title'"); + } + + private updateDescription(description: string) { + this._meta.updateTag({content: description}, "name='description'"); + this._meta.updateTag({content: description}, "property='og:description'"); } } \ No newline at end of file diff --git a/explore/src/app/sdg/sdg.module.ts b/explore/src/app/sdg/sdg.module.ts index 560340a3..fa7babc8 100644 --- a/explore/src/app/sdg/sdg.module.ts +++ b/explore/src/app/sdg/sdg.module.ts @@ -6,6 +6,7 @@ import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRout import {BreadcrumbsModule} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.module"; import {RefineFieldResultsServiceModule} from "../openaireLibrary/services/refineFieldResultsService.module"; import {LoadingModule} from "../openaireLibrary/utils/loading/loading.module"; +import {Schema2jsonldModule} from "../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module"; import {SdgRoutingModule} from './sdg-routing.module'; import {SdgComponent} from './sdg.component'; @@ -14,7 +15,7 @@ import {SdgComponent} from './sdg.component'; imports: [ CommonModule, FormsModule, RouterModule, SdgRoutingModule, BreadcrumbsModule, RefineFieldResultsServiceModule, - LoadingModule + LoadingModule, Schema2jsonldModule ], declarations: [ SdgComponent diff --git a/explore/src/assets/openaire-theme b/explore/src/assets/openaire-theme index 5940eee3..4fca369b 160000 --- a/explore/src/assets/openaire-theme +++ b/explore/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit 5940eee3a04ba2f8f46c5ffcb1a42824e9f89dbd +Subproject commit 4fca369b2e4f4f2c2689e0efc501d2c548dfeb68