From 8976d564956904a5381211fb97b117ace51b2234 Mon Sep 17 00:00:00 2001 From: itzMiney Date: Sun, 8 Nov 2026 01:54:41 +0100 Subject: [PATCH] make seo helper service buttons optional and reuse components v2 script builder for meta on every page --- src/app/shared/services/seo.service.ts | 57 ++++++++++++++------------ 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/src/app/shared/services/seo.service.ts b/src/app/shared/services/seo.service.ts index 1f863f0..aa4485f 100644 --- a/src/app/shared/services/seo.service.ts +++ b/src/app/shared/services/seo.service.ts @@ -54,39 +54,42 @@ export class SeoService { existingScript.remove(); } - if (!buttons || buttons.length === 0) return; + const sectionComponent = { + type: 9, + components: [ + { + type: 10, + content: `### [${meta?.title ?? ''}](${meta?.currentUrl ?? ''})\n${meta?.description ?? ''}` + } + ], + accessory: { + type: 11, + media: { + url: 'https://itzminey.dev/assets/thumb.png' + } + } + }; + + const containerComponents: any[] = [sectionComponent]; + + if (buttons && buttons.length > 0) { + containerComponents.push({ + type: 1, + components: buttons.map(btn => ({ + type: 2, + label: btn.label, + style: 5, + url: btn.url + })) + }); + } const componentPayload = { flags: 32768, component: { type: 17, accent_color: parseInt(this.siteColor.replace('#', ''), 16), - components: [ - { - type: 9, - components: [ - { - type: 10, - content: `### [${meta?.title ?? ''}](${meta?.currentUrl ?? ''})\n${meta?.description ?? ''}` - } - ], - accessory: { - type: 11, - media: { - url: 'https://itzminey.dev/assets/thumb.png' - } - } - }, - { - type: 1, // Action Row for buttons - components: buttons.map(btn => ({ - type: 2, - label: btn.label, - style: 5, - url: btn.url - })) - } - ] + components: containerComponents } };