feat: update title description and keywords (#5689)

This commit is contained in:
maksim-karatkevich 2020-05-20 18:06:57 +03:00 committed by GitHub
parent 994522c2c0
commit a7d1716fc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 71 additions and 36 deletions

View file

@ -9,17 +9,18 @@ export class MetadataService {
private meta: Meta,
) {}
updateTitle(title: string) {
updateTitle(title: string): void {
this.title.setTitle(title);
this.meta.updateTag({ property: 'og:title', content: title });
}
updateDescription(desc: string) {
updateDescription(desc: string): void {
this.meta.updateTag({ name: 'description', content: desc });
this.meta.updateTag({ property: 'og:description', content: desc });
}
updateKeywords(keywords: string): void {
this.meta.updateTag({ name: 'keywords', content: keywords });
}
}

View file

@ -3,7 +3,7 @@ import { NbThemeService } from '@nebular/theme';
import { takeWhile } from 'rxjs/operators' ;
import { SolarData } from '../../@core/data/solar';
import { AbService } from '../../@core/utils/ab.service';
import {MetadataService} from '../../@core/utils/metadata.service';
import { MetadataService } from '../../@core/utils/metadata.service';
interface CardSettings {
title: string;
@ -103,7 +103,10 @@ export class DashboardComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.metaDataService.updateTitle('Ngx-admin IoT dashboard on Angular 9+ and Nebular.');
this.metaDataService.updateTitle('Ngx-admin IoT dashboard on Angular 9+ and Nebular');
this.metaDataService.updateDescription('IoT dashboard on Ngx-admin is Angular 9+ Bootstrap 4+ admin' +
' dashboard template. Over 40+ Angular Components and 60+ Usage Examples. Completely FREE and MIT licensed.');
this.metaDataService.updateKeywords('ngx admin, ngx admin dashboard, ngx iot dashboard, ngx-admin iot template');
this.abService.onAbEvent(AbService.VARIANT_HIDE_CALL_ACTION)
.pipe(takeWhile(() => this.alive))

View file

@ -1,7 +1,7 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { takeWhile } from 'rxjs/operators';
import { AbService } from '../../@core/utils/ab.service';
import {MetadataService} from '../../@core/utils/metadata.service';
import { MetadataService } from '../../@core/utils/metadata.service';
@Component({
selector: 'ngx-ecommerce',
@ -17,6 +17,9 @@ export class ECommerceComponent implements OnInit, OnDestroy {
ngOnInit() {
this.metaDataService.updateTitle('Ngx-admin e-commerce dashboard on Angular 9+ and Nebular.');
this.metaDataService.updateDescription('E-commerce dashboard on Ngx-admin is Angular 9+ Bootstrap 4+ admin' +
' dashboard template. Over 40+ Angular Components and 60+ Usage Examples. Completely FREE and MIT licensed.');
this.metaDataService.updateKeywords('ngx-admin dashboard, ngx ecommerce dashboard, angular 9+');
this.abService.onAbEvent(AbService.VARIANT_HIDE_CALL_ACTION)
.pipe(takeWhile(() => this.alive))

View file

@ -35,7 +35,11 @@ export class PagesComponent implements OnInit, OnDestroy {
.pipe(takeUntil(this.destroy$))
.subscribe((data: { tag: string; item: NbMenuItem }) => {
if (data.item.title !== 'E-commerce' && data.item.title !== 'IoT Dashboard')
this.metaDataService.updateTitle(`Ngx-admin dashboard by Akveo| ${data.item.title}`);
this.metaDataService.updateTitle(`Ngx-admin dashboard by Akveo | ${data.item.title}`);
this.metaDataService.updateDescription('Ngx-admin is Angular 9+ Bootstrap 4+ admin dashboard template.' +
' Over 40+ Angular Components, 60+ Usage Examples and UI features.');
this.metaDataService.updateKeywords('ngx-admin, ngx admin dashboard features, ngx admin forms,' +
' ngx-admin maps, ngx-admin UI features, ngx-admin tables, ngx admin overlays, ngx-admin extra components');
});
}

View file

@ -1,16 +1,17 @@
import {Component, OnDestroy} from '@angular/core';
import {NbMediaBreakpoint} from '@nebular/theme';
import {Router} from '@angular/router';
import {AnalyticsService} from '../@core/utils';
import {CurrentThemeService} from '../@core/utils/theme.service';
import {Observable} from 'rxjs';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { NbMediaBreakpoint } from '@nebular/theme';
import { Router } from '@angular/router';
import { AnalyticsService } from '../@core/utils';
import { CurrentThemeService } from '../@core/utils/theme.service';
import { Observable } from 'rxjs';
import { MetadataService } from '../@core/utils/metadata.service';
@Component({
selector: 'ngx-starter',
templateUrl: './starter.component.html',
styleUrls: ['./starter.component.scss'],
})
export class NgxStarterComponent implements OnDestroy {
export class NgxStarterComponent implements OnDestroy, OnInit {
breakpoint: NbMediaBreakpoint;
breakpoints: any;
@ -50,8 +51,15 @@ export class NgxStarterComponent implements OnDestroy {
constructor(private router: Router,
private currentThemeService: CurrentThemeService,
private analytics: AnalyticsService,
private metadataService: MetadataService,
) {}
ngOnInit(): void {
this.metadataService.updateTitle('Ngx-admin themes for e-commerce dashboard on Angular 9+ and Nebular');
this.metadataService.updateDescription('Choose a theme for ngx-admin e-commerce dashboard: Material, Light and Dark, Cosmic and Corporate.');
this.metadataService.updateKeywords('Ngx-admin themes, material theme, ngx-admin cosmic, ngx-admin corporate theme, dark theme ngx-admin');
}
navigate(themeName: string) {
this.currentThemeService.setCurrentTheme(themeName);
this.router.navigate(['/pages/dashboard'], {queryParams: {theme: themeName}});