From 44ca207f2f5b9a3e5fd4752d0110530d79329299 Mon Sep 17 00:00:00 2001
From: emlys <43770515+emlys@users.noreply.github.com>
Date: Wed, 11 Sep 2019 11:17:21 -0700
Subject: [PATCH] dockstore/dockstore#2445 updated to google recommendation
(#786)
dockstore/dockstore#2445 updated homepage JSON LD to match google recommendations
---
src/app/home-page/home-page.component.html | 2 ++
src/app/home-page/home-page.component.spec.ts | 4 ++-
src/app/home-page/home-page.component.ts | 7 +++++-
src/app/home-page/home-page.module.ts | 15 +++++++++--
src/app/home-page/home-page.service.ts | 25 +++++++++++++++++++
src/index.html | 22 ----------------
6 files changed, 49 insertions(+), 26 deletions(-)
diff --git a/src/app/home-page/home-page.component.html b/src/app/home-page/home-page.component.html
index 658fe48ee3..791758df7e 100644
--- a/src/app/home-page/home-page.component.html
+++ b/src/app/home-page/home-page.component.html
@@ -1,4 +1,6 @@
+
+
diff --git a/src/app/home-page/home-page.component.spec.ts b/src/app/home-page/home-page.component.spec.ts
index 01865ca9f7..cd9491aa01 100644
--- a/src/app/home-page/home-page.component.spec.ts
+++ b/src/app/home-page/home-page.component.spec.ts
@@ -2,6 +2,7 @@
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HomePageComponent } from './home-page.component';
+import { RouterTestingModule } from '@angular/router/testing';
describe('HomePageComponent', () => {
let component: HomePageComponent;
@@ -10,7 +11,8 @@ describe('HomePageComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [HomePageComponent],
- schemas: [NO_ERRORS_SCHEMA]
+ schemas: [NO_ERRORS_SCHEMA],
+ imports: [RouterTestingModule]
}).compileComponents();
}));
diff --git a/src/app/home-page/home-page.component.ts b/src/app/home-page/home-page.component.ts
index bb2dc3c34d..c3ecc9f6c3 100644
--- a/src/app/home-page/home-page.component.ts
+++ b/src/app/home-page/home-page.component.ts
@@ -3,6 +3,7 @@ import { devMode } from 'app/shared/constants';
import { User } from 'app/shared/swagger';
import { UserQuery } from 'app/shared/user/user.query';
import { Observable } from 'rxjs';
+import { HomePageService } from './home-page.service';
@Component({
selector: 'app-home-page',
@@ -12,9 +13,13 @@ import { Observable } from 'rxjs';
export class HomePageComponent implements OnInit {
devMode = devMode;
public user$: Observable;
- constructor(private userQuery: UserQuery) {}
+ public orgSchema;
+ public websiteSchema;
+ constructor(private userQuery: UserQuery, private homePageService: HomePageService) {}
ngOnInit() {
this.user$ = this.userQuery.user$;
+ this.orgSchema = this.homePageService.hpOrgSchema;
+ this.websiteSchema = this.homePageService.hpWebsiteSchema;
}
}
diff --git a/src/app/home-page/home-page.module.ts b/src/app/home-page/home-page.module.ts
index 8ef18d8fee..faa2ad97b7 100644
--- a/src/app/home-page/home-page.module.ts
+++ b/src/app/home-page/home-page.module.ts
@@ -1,5 +1,6 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
+import { NgxJsonLdModule } from '@ngx-lite/json-ld';
import { FlexLayoutModule } from '@angular/flex-layout';
import { RouterModule } from '@angular/router';
import { HomeLoggedInComponent } from 'app/home-page/home-logged-in/home-logged-in.component';
@@ -13,8 +14,18 @@ import { HomePageComponent } from './home-page.component';
import { OldHomePageComponent, YoutubeComponent } from './old-home-page/old-home-page.component';
@NgModule({
- imports: [CommonModule, CustomMaterialModule, FlexLayoutModule, RouterModule, ListWorkflowsModule, ListContainersModule, TabsModule],
+ imports: [
+ CommonModule,
+ CustomMaterialModule,
+ FlexLayoutModule,
+ NgxJsonLdModule,
+ RouterModule,
+ ListWorkflowsModule,
+ ListContainersModule,
+ TabsModule
+ ],
declarations: [HomePageComponent, LoggedInBannerComponent, HomeComponent, HomeLoggedInComponent, OldHomePageComponent, YoutubeComponent],
- entryComponents: [YoutubeComponent]
+ entryComponents: [YoutubeComponent],
+ exports: [NgxJsonLdModule]
})
export class HomePageModule {}
diff --git a/src/app/home-page/home-page.service.ts b/src/app/home-page/home-page.service.ts
index eb2853892b..37767fe9dd 100644
--- a/src/app/home-page/home-page.service.ts
+++ b/src/app/home-page/home-page.service.ts
@@ -6,6 +6,31 @@ import { Router } from '@angular/router';
})
export class HomePageService {
constructor(private router: Router) {}
+ hpOrgSchema = {
+ '@context': 'http://schema.org',
+ '@type': 'Organization',
+ description:
+ 'Dockstore, developed by the Cancer Genome Collaboratory, is an open platform used by the GA4GH for sharing ' +
+ 'Docker-based tools described with the Common Workflow Language (CWL), the Workflow Description Language (WDL), or Nextflow (NFL)',
+ logo: '../assets/images/dockstore/dockstore.png',
+ name: 'Dockstore',
+ sameAs: 'https://github.com/dockstore',
+ url: window.location.href
+ };
+
+ hpWebsiteSchema = {
+ '@context': 'http://schema.org',
+ '@type': 'WebSite',
+ audience: 'Bioinformaticians',
+ name: 'Dockstore',
+ potentialAction: {
+ '@type': 'SearchAction',
+ target: window.location.href + 'search?search={search_term_string}',
+ 'query-input': 'required name=search_term_string'
+ },
+ url: window.location.href
+ };
+
goToSearch(searchValue: string) {
this.router.navigate(['/search'], { queryParams: { search: searchValue } });
}
diff --git a/src/index.html b/src/index.html
index c7a4ff79ad..d2803e6869 100644
--- a/src/index.html
+++ b/src/index.html
@@ -9,28 +9,6 @@
-
-