From cca53006f46b43dc9b46125a7c8b326ee9f9099a Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 2 Apr 2020 19:22:11 +0300 Subject: [PATCH] fix(pages): fix titles and descriptions --- .../components/footer/footer.component.html | 2 +- .../components/footer/footer.component.ts | 3 +++ docs/app/app.module.ts | 2 ++ docs/app/pages/docs/landing-docs.component.ts | 22 +++++++++++-------- docs/app/pages/home/landing-home.component.ts | 7 ++++-- .../material-landing.component.html | 4 +++- .../material-landing.component.ts | 6 ++++- docs/index.html | 4 ++-- src/app/@core/core.module.ts | 2 ++ src/app/@core/utils/metadata.service.ts | 21 ++++++++++++++++++ .../electricity/electricity.component.html | 4 ++-- 11 files changed, 59 insertions(+), 18 deletions(-) create mode 100644 src/app/@core/utils/metadata.service.ts diff --git a/docs/app/@theme/components/footer/footer.component.html b/docs/app/@theme/components/footer/footer.component.html index c728731b..eb5c7036 100644 --- a/docs/app/@theme/components/footer/footer.component.html +++ b/docs/app/@theme/components/footer/footer.component.html @@ -36,7 +36,7 @@
  • - © 2015-2018 Akveo LLC
    + © 2015-{{currentYear}} Akveo LLC
    Documentation licensed under CC BY 4.0.
  • diff --git a/docs/app/@theme/components/footer/footer.component.ts b/docs/app/@theme/components/footer/footer.component.ts index 54985d21..16c0a606 100644 --- a/docs/app/@theme/components/footer/footer.component.ts +++ b/docs/app/@theme/components/footer/footer.component.ts @@ -12,4 +12,7 @@ import { Component } from '@angular/core'; templateUrl: './footer.component.html', }) export class NgxLandingFooterComponent { + get currentYear() { + return new Date().getFullYear(); + } } diff --git a/docs/app/app.module.ts b/docs/app/app.module.ts index 00b842bb..19521b7b 100644 --- a/docs/app/app.module.ts +++ b/docs/app/app.module.ts @@ -18,6 +18,7 @@ import { LandingSharedModule } from './shared/landing-shared.module'; import { DOCS, STRUCTURE } from './app.options'; const docs = require('../output.json'); import { structure } from '../structure'; +import {MetadataService} from '../../src/app/@core/utils/metadata.service'; @NgModule({ declarations: [ @@ -36,6 +37,7 @@ import { structure } from '../structure'; bootstrap: [AppComponent], providers: [ Title, + MetadataService, { provide: STRUCTURE, useValue: structure }, { provide: DOCS, useValue: docs }, ], diff --git a/docs/app/pages/docs/landing-docs.component.ts b/docs/app/pages/docs/landing-docs.component.ts index 14bf0bce..c66daff2 100644 --- a/docs/app/pages/docs/landing-docs.component.ts +++ b/docs/app/pages/docs/landing-docs.component.ts @@ -4,18 +4,18 @@ * Licensed under the MIT License. See License.txt in the project root for license information. */ -import { Component, OnDestroy } from '@angular/core'; -import { Router } from '@angular/router'; -import { takeWhile, withLatestFrom, map } from 'rxjs/operators'; +import {Component, OnDestroy} from '@angular/core'; +import {Router} from '@angular/router'; +import {map, takeWhile, withLatestFrom} from 'rxjs/operators'; import { - NbThemeService, + NbMediaBreakpoint, NbMenuItem, NbSidebarService, - NbMediaBreakpoint, -} from '@nebular/theme'; + NbThemeService} from '@nebular/theme'; -import { NgxMenuService } from '../../@theme/services/menu.service'; -import { NgxPaginationService } from '../../@theme/services/pagination.service'; +import {NgxMenuService} from '../../@theme/services/menu.service'; +import {NgxPaginationService} from '../../@theme/services/pagination.service'; +import {MetadataService} from '../../../../src/app/@core/utils/metadata.service'; @Component({ selector: 'ngx-landing-docs', @@ -34,7 +34,11 @@ export class LandingDocsComponent implements OnDestroy { private router: Router, private themeService: NbThemeService, private sidebarService: NbSidebarService, - private paginationService: NgxPaginationService) { + private paginationService: NgxPaginationService, + private metadataService: MetadataService) { + + this.metadataService.updateDescription('Use ngx-admin to bootstrap the development of your product and' + + ' provide an ecosystem for building production-ready apps or prototypes. Free and Open Source!'); this.themeService.changeTheme('docs-page'); this.paginationService.setPaginationItems('/docs'); diff --git a/docs/app/pages/home/landing-home.component.ts b/docs/app/pages/home/landing-home.component.ts index 91f69883..934e550d 100644 --- a/docs/app/pages/home/landing-home.component.ts +++ b/docs/app/pages/home/landing-home.component.ts @@ -6,6 +6,7 @@ import { Component } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; +import {MetadataService} from '../../../../src/app/@core/utils/metadata.service'; @Component({ selector: 'ngx-landing-home', @@ -13,8 +14,10 @@ import { NbThemeService } from '@nebular/theme'; styleUrls: ['./landing-home.component.scss'], }) export class LandingHomeComponent { - - constructor(private themeService: NbThemeService) { + constructor(private themeService: NbThemeService, private metadataService: MetadataService) { + this.metadataService.updateDescription('Save more than $33,000 using ngx-admin for personal and commercial' + + ' use. The dashboard is based on Angular 9+ and Bootstrap 4+. Completely FREE and MIT licensed.'); + this.metadataService.updateTitle('The most popular admin dashboard based on Angular 9+ and Nebular.'); this.themeService.changeTheme('ngx-landing'); } } diff --git a/docs/app/pages/home/material-landing/material-landing.component.html b/docs/app/pages/home/material-landing/material-landing.component.html index 9eebd708..5f9a2287 100644 --- a/docs/app/pages/home/material-landing/material-landing.component.html +++ b/docs/app/pages/home/material-landing/material-landing.component.html @@ -1,6 +1,8 @@ - + + + diff --git a/docs/app/pages/home/material-landing/material-landing.component.ts b/docs/app/pages/home/material-landing/material-landing.component.ts index fc0980bf..96b15989 100644 --- a/docs/app/pages/home/material-landing/material-landing.component.ts +++ b/docs/app/pages/home/material-landing/material-landing.component.ts @@ -1,5 +1,6 @@ import { Component } from '@angular/core'; import { NbThemeService } from '@nebular/theme'; +import {MetadataService} from '../../../../../src/app/@core/utils/metadata.service'; @Component({ selector: 'ngx-material-landing', @@ -10,7 +11,10 @@ import { NbThemeService } from '@nebular/theme'; ], }) export class MaterialLandingComponent { - constructor(private themeService: NbThemeService) { + constructor(private themeService: NbThemeService, private metadataService: MetadataService) { + this.metadataService.updateDescription('Ngx-admin material works perfectly with Angular Material and Nebular.' + + ' Over 40+ Angular Components and 60+ Usage Examples.Take the best from both!'); + this.metadataService.updateTitle('New Material theme of ngx-admin dashboard template based on Angular 9+'); this.themeService.changeTheme('ngx-landing-material'); } } diff --git a/docs/index.html b/docs/index.html index a27ad70a..5ec3f90e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2,9 +2,9 @@ - ngx-admin: Free Open Source admin dashboard template based on Angular, Bootstrap + The most popular admin dashboard based on Angular 9+ and Nebular. - + diff --git a/src/app/@core/core.module.ts b/src/app/@core/core.module.ts index ca8160e8..8563613a 100644 --- a/src/app/@core/core.module.ts +++ b/src/app/@core/core.module.ts @@ -57,6 +57,7 @@ import { MockDataModule } from './mock/mock-data.module'; import { AbService } from './utils/ab.service'; import {CurrentThemeService} from './utils/theme.service'; import {ThemeGuard} from './guard/theme.guard'; +import {MetadataService} from './utils/metadata.service'; const socialLinks = [ { @@ -153,6 +154,7 @@ export const NB_CORE_PROVIDERS = [ LayoutService, PlayerService, SeoService, + MetadataService, StateService, AbService, CurrentThemeService, diff --git a/src/app/@core/utils/metadata.service.ts b/src/app/@core/utils/metadata.service.ts new file mode 100644 index 00000000..7e13a686 --- /dev/null +++ b/src/app/@core/utils/metadata.service.ts @@ -0,0 +1,21 @@ +import {Injectable} from '@angular/core'; +import {Meta, Title} from '@angular/platform-browser'; + +@Injectable() +export class MetadataService { + + constructor( + private title: Title, + private meta: Meta, + ) {} + + updateTitle(title: string) { + this.title.setTitle(title); + } + + updateDescription(desc: string) { + this.meta.updateTag({ name: 'description', content: desc }); + } + + +} diff --git a/src/app/pages/dashboard/electricity/electricity.component.html b/src/app/pages/dashboard/electricity/electricity.component.html index c68ede53..7085cbd7 100644 --- a/src/app/pages/dashboard/electricity/electricity.component.html +++ b/src/app/pages/dashboard/electricity/electricity.component.html @@ -37,8 +37,8 @@ 291 USD - - {{ t }} + + {{ t }}