Added theme-color to metaService
This commit is contained in:
1 parent
995ec2b7a7
commit
ebec982879
2 files changed
+17
-8
No files matched your search
@@ -51,18 +51,19 @@ export class AppComponent implements OnInit {
|
||||
)
|
||||
.subscribe(data => {
|
||||
const meta = data['meta'] || {};
|
||||
if (this.router.url === '/') {
|
||||
// Add specific fallback meta for root route
|
||||
if (this.router.url === '/about') {
|
||||
// fallback meta
|
||||
meta.title = meta.title || 'itzMiney\'s Home';
|
||||
meta.description = meta.description || 'Welcome to itzMiney\'s Homepage! Here you can find my portfolio and other cool stuff.';
|
||||
meta.image = meta.image || 'https://itzminey.dev/assets/ogimg.png';
|
||||
meta.url = meta.url || 'https://itzminey.dev';
|
||||
meta.color = meta.color || '#eb284c';
|
||||
}
|
||||
this.updateMetaTags(meta);
|
||||
});
|
||||
}
|
||||
|
||||
updateMetaTags(meta: { title?: string; description?: string; image?: string; url?: string }) {
|
||||
updateMetaTags(meta: { title?: string; description?: string; image?: string; url?: string; color?: string }) {
|
||||
if (meta.title) {
|
||||
this.titleService.setTitle(meta.title);
|
||||
this.metaService.updateTag({ name: 'og:title', content: meta.title });
|
||||
@@ -77,5 +78,9 @@ export class AppComponent implements OnInit {
|
||||
if (meta.url) {
|
||||
this.metaService.updateTag({ name: 'og:url', content: meta.url });
|
||||
}
|
||||
if (meta.color) {
|
||||
this.titleService.setTitle(meta.color);
|
||||
this.metaService.updateTag({ name: 'theme-color', content: meta.color});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,14 +13,15 @@ export const routes: Routes = [
|
||||
title: 'itzMiney\'s Home',
|
||||
description: 'Welcome to itzMiney\'s Homepage! Here you can find my portfolio and other cool stuff.',
|
||||
image: 'https://itzminey.dev/assets/ogimg.png',
|
||||
url: 'https://itzminey.dev/about'
|
||||
url: 'https://itzminey.dev/about',
|
||||
color: '#eb284c'
|
||||
}
|
||||
}
|
||||
}, // Redirect default route to 'about'
|
||||
{
|
||||
path: 'about',
|
||||
redirectTo: '/',
|
||||
pathMatch: 'full'
|
||||
pathMatch: 'full',
|
||||
},
|
||||
{
|
||||
path: 'portfolio',
|
||||
@@ -30,7 +31,8 @@ export const routes: Routes = [
|
||||
title: 'Portfolio | itzMiney',
|
||||
description: 'This is my portfolio where you can find examples of my designs and other projects!',
|
||||
image: 'https://itzminey.dev/assets/ogimg.png',
|
||||
url: 'https://itzminey.dev/portfolio'
|
||||
url: 'https://itzminey.dev/portfolio',
|
||||
color: '#eb284c'
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -42,7 +44,8 @@ export const routes: Routes = [
|
||||
title: 'Blog | itzMiney',
|
||||
description: 'Welcome to my blog! I\'ll post occasional updates here on the stuff I\'m currently up to.',
|
||||
image: 'https://itzminey.dev/assets/ogimg.png',
|
||||
url: 'https://itzminey.dev/blog'
|
||||
url: 'https://itzminey.dev/blog',
|
||||
color: '#eb284c'
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -55,7 +58,8 @@ export const routes: Routes = [
|
||||
title: '404 | Page Not Found',
|
||||
description: 'How the hell did you end up here?',
|
||||
image: 'https://itzminey.dev/assets/ogimg.png',
|
||||
url: 'https://itzminey.dev/404'
|
||||
url: 'https://itzminey.dev/404',
|
||||
color: '#eb284c'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user