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 => {
|
.subscribe(data => {
|
||||||
const meta = data['meta'] || {};
|
const meta = data['meta'] || {};
|
||||||
if (this.router.url === '/') {
|
if (this.router.url === '/about') {
|
||||||
// Add specific fallback meta for root route
|
// fallback meta
|
||||||
meta.title = meta.title || 'itzMiney\'s Home';
|
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.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.image = meta.image || 'https://itzminey.dev/assets/ogimg.png';
|
||||||
meta.url = meta.url || 'https://itzminey.dev';
|
meta.url = meta.url || 'https://itzminey.dev';
|
||||||
|
meta.color = meta.color || '#eb284c';
|
||||||
}
|
}
|
||||||
this.updateMetaTags(meta);
|
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) {
|
if (meta.title) {
|
||||||
this.titleService.setTitle(meta.title);
|
this.titleService.setTitle(meta.title);
|
||||||
this.metaService.updateTag({ name: 'og:title', content: meta.title });
|
this.metaService.updateTag({ name: 'og:title', content: meta.title });
|
||||||
@@ -77,5 +78,9 @@ export class AppComponent implements OnInit {
|
|||||||
if (meta.url) {
|
if (meta.url) {
|
||||||
this.metaService.updateTag({ name: 'og:url', content: 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',
|
title: 'itzMiney\'s Home',
|
||||||
description: 'Welcome to itzMiney\'s Homepage! Here you can find my portfolio and other cool stuff.',
|
description: 'Welcome to itzMiney\'s Homepage! Here you can find my portfolio and other cool stuff.',
|
||||||
image: 'https://itzminey.dev/assets/ogimg.png',
|
image: 'https://itzminey.dev/assets/ogimg.png',
|
||||||
url: 'https://itzminey.dev/about'
|
url: 'https://itzminey.dev/about',
|
||||||
|
color: '#eb284c'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, // Redirect default route to 'about'
|
}, // Redirect default route to 'about'
|
||||||
{
|
{
|
||||||
path: 'about',
|
path: 'about',
|
||||||
redirectTo: '/',
|
redirectTo: '/',
|
||||||
pathMatch: 'full'
|
pathMatch: 'full',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'portfolio',
|
path: 'portfolio',
|
||||||
@@ -30,7 +31,8 @@ export const routes: Routes = [
|
|||||||
title: 'Portfolio | itzMiney',
|
title: 'Portfolio | itzMiney',
|
||||||
description: 'This is my portfolio where you can find examples of my designs and other projects!',
|
description: 'This is my portfolio where you can find examples of my designs and other projects!',
|
||||||
image: 'https://itzminey.dev/assets/ogimg.png',
|
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',
|
title: 'Blog | itzMiney',
|
||||||
description: 'Welcome to my blog! I\'ll post occasional updates here on the stuff I\'m currently up to.',
|
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',
|
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',
|
title: '404 | Page Not Found',
|
||||||
description: 'How the hell did you end up here?',
|
description: 'How the hell did you end up here?',
|
||||||
image: 'https://itzminey.dev/assets/ogimg.png',
|
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