make seo helper service buttons optional and reuse components v2 script builder for meta on every page
This commit is contained in:
1 parent
921659a2c2
commit
8976d56495
1 file changed
+16
-13
@@ -54,15 +54,7 @@ export class SeoService {
|
|||||||
existingScript.remove();
|
existingScript.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!buttons || buttons.length === 0) return;
|
const sectionComponent = {
|
||||||
|
|
||||||
const componentPayload = {
|
|
||||||
flags: 32768,
|
|
||||||
component: {
|
|
||||||
type: 17,
|
|
||||||
accent_color: parseInt(this.siteColor.replace('#', ''), 16),
|
|
||||||
components: [
|
|
||||||
{
|
|
||||||
type: 9,
|
type: 9,
|
||||||
components: [
|
components: [
|
||||||
{
|
{
|
||||||
@@ -76,17 +68,28 @@ export class SeoService {
|
|||||||
url: 'https://itzminey.dev/assets/thumb.png'
|
url: 'https://itzminey.dev/assets/thumb.png'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
};
|
||||||
{
|
|
||||||
type: 1, // Action Row for buttons
|
const containerComponents: any[] = [sectionComponent];
|
||||||
|
|
||||||
|
if (buttons && buttons.length > 0) {
|
||||||
|
containerComponents.push({
|
||||||
|
type: 1,
|
||||||
components: buttons.map(btn => ({
|
components: buttons.map(btn => ({
|
||||||
type: 2,
|
type: 2,
|
||||||
label: btn.label,
|
label: btn.label,
|
||||||
style: 5,
|
style: 5,
|
||||||
url: btn.url
|
url: btn.url
|
||||||
}))
|
}))
|
||||||
|
});
|
||||||
}
|
}
|
||||||
]
|
|
||||||
|
const componentPayload = {
|
||||||
|
flags: 32768,
|
||||||
|
component: {
|
||||||
|
type: 17,
|
||||||
|
accent_color: parseInt(this.siteColor.replace('#', ''), 16),
|
||||||
|
components: containerComponents
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user