diff --git a/package-lock.json b/package-lock.json index a553dc8..db4cda4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,7 @@ "@types/three": "^0.171.0", "express": "^4.18.2", "ngx-device-detector": "^9.0.0", + "ngx-meta": "^0.0.1", "react": "^19.0.0", "rxjs": "~7.8.0", "three": "^0.171.0", @@ -10681,6 +10682,12 @@ "@angular/core": "^19.0.0" } }, + "node_modules/ngx-meta": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/ngx-meta/-/ngx-meta-0.0.1.tgz", + "integrity": "sha512-6KAvNyzr3uRt6qDErzzE/8Tw5dFYLD2QmBzE0eMril4ZlHRy1Fgbi/WzOVSl2sLr3JqXa6w3fD6wMnPPblndtw==", + "license": "MIT" + }, "node_modules/node-addon-api": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-6.1.0.tgz", diff --git a/package.json b/package.json index fbc10c6..bb81e16 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "@types/three": "^0.171.0", "express": "^4.18.2", "ngx-device-detector": "^9.0.0", + "ngx-meta": "^0.0.1", "react": "^19.0.0", "rxjs": "~7.8.0", "three": "^0.171.0", @@ -49,4 +50,4 @@ "karma-jasmine-html-reporter": "~2.1.0", "typescript": "~5.6.2" } -} \ No newline at end of file +} diff --git a/public/assets/ogimg.png b/public/assets/ogimg.png index 6c2662c..ccfbd98 100644 Binary files a/public/assets/ogimg.png and b/public/assets/ogimg.png differ diff --git a/src/app/app.component.ts b/src/app/app.component.ts index dc2bd86..b4b17dd 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -40,6 +40,13 @@ export class AppComponent implements OnInit { ) .subscribe(data => { const meta = data['meta'] || {}; + if (this.router.url === '/') { + // Add specific fallback meta for root route + 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'; + } this.updateMetaTags(meta); }); } diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index b200ef8..c29fc34 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -12,7 +12,7 @@ export const routes: Routes = [ data: { meta: { title: 'itzMiney\'s Home', - description: 'Welcome to itzMiney\'s Homepage! \bHere 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', url: 'https://itzminey.dev/about' } @@ -24,7 +24,7 @@ export const routes: Routes = [ data: { meta: { title: 'itzMiney\'s Home', - description: 'Welcome to itzMiney\'s Homepage! \bHere 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', url: 'https://itzminey.dev/about' } @@ -48,7 +48,7 @@ export const routes: Routes = [ data: { meta: { title: 'Blog | itzMiney', - description: 'Welcome to my blog! \bI\'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', url: 'https://itzminey.dev/blog' } diff --git a/src/main.server.ts b/src/main.server.ts index 1198368..4b9d4d1 100644 --- a/src/main.server.ts +++ b/src/main.server.ts @@ -1,7 +1,6 @@ import { bootstrapApplication } from '@angular/platform-browser'; import { AppComponent } from './app/app.component'; import { config } from './app/app.config.server'; -import { platformServer } from '@angular/platform-server'; const bootstrap = () => bootstrapApplication(AppComponent, config); diff --git a/src/server.ts b/src/server.ts index 0f3612e..99cee37 100644 --- a/src/server.ts +++ b/src/server.ts @@ -41,11 +41,8 @@ app.use( * Handle all other requests by rendering the Angular application. */ app.use('/**', (req, res, next) => { - angularApp - .handle(req) - .then((response) => - response ? writeResponseToNodeResponse(response, res) : next(), - ) + angularApp.handle(req) + .then(response => response ? res.send(response) : next()) .catch(next); });