From 1dd65ecb69500fffea8d1d69a1eec61231dd3968 Mon Sep 17 00:00:00 2001 From: kachourihassen <60717797+kachourihassen@users.noreply.github.com> Date: Fri, 29 Sep 2023 16:21:22 +0100 Subject: [PATCH 1/2] Meta property content (#582) * Social Share Preview * LimiteDescription * wip * ATTR.CONTENT * Optimisation de code * change by content * inside the index * wip * remove all meta bin side the campaign details * updateMetaTags --- .../campaign-details-container.component.html | 19 ++++--- .../campaign-details-container.component.ts | 53 ++++++++++++------- src/index.html | 6 +-- 3 files changed, 47 insertions(+), 31 deletions(-) diff --git a/src/app/campaigns/campaign-details/components/campaign-details-container/campaign-details-container.component.html b/src/app/campaigns/campaign-details/components/campaign-details-container/campaign-details-container.component.html index 699f0874a..e0f4afba2 100755 --- a/src/app/campaigns/campaign-details/components/campaign-details-container/campaign-details-container.component.html +++ b/src/app/campaigns/campaign-details/components/campaign-details-container/campaign-details-container.component.html @@ -1,19 +1,19 @@ - - - + + + - - + --> + + +
@@ -21,8 +21,7 @@
- - + - + --> + From 4c8fbba50fad1f8a55b15a1d5d604af4fc0ffb63 Mon Sep 17 00:00:00 2001 From: kachourihassen <60717797+kachourihassen@users.noreply.github.com> Date: Fri, 29 Sep 2023 16:58:19 +0100 Subject: [PATCH 2/2] Meta property content (#584) * Social Share Preview * LimiteDescription * wip * ATTR.CONTENT * Optimisation de code * change by content * inside the index * wip * remove all meta bin side the campaign details * updateMetaTags * delete the meta in the index html * delete the meta in the index html * delete the meta in the index html * delete the meta in the index --- .../campaign-details-container.component.html | 6 +----- .../campaign-details-container.component.ts | 21 ++++++++++++++++++- src/index.html | 17 +++++++-------- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/app/campaigns/campaign-details/components/campaign-details-container/campaign-details-container.component.html b/src/app/campaigns/campaign-details/components/campaign-details-container/campaign-details-container.component.html index e0f4afba2..721e7e32e 100755 --- a/src/app/campaigns/campaign-details/components/campaign-details-container/campaign-details-container.component.html +++ b/src/app/campaigns/campaign-details/components/campaign-details-container/campaign-details-container.component.html @@ -1,4 +1,4 @@ - + - - - -
diff --git a/src/app/campaigns/campaign-details/components/campaign-details-container/campaign-details-container.component.ts b/src/app/campaigns/campaign-details/components/campaign-details-container/campaign-details-container.component.ts index f3c21891c..10397d011 100755 --- a/src/app/campaigns/campaign-details/components/campaign-details-container/campaign-details-container.component.ts +++ b/src/app/campaigns/campaign-details/components/campaign-details-container/campaign-details-container.component.ts @@ -152,7 +152,7 @@ export class CampaignDetailsContainerComponent implements OnInit { setTimeout(() => { this.showmoonboy = campaign.id === this.campaignId; }, 1000); - + /*this.ogImageUrl = campaign.coverSrcMobile.includes('ipfs') ? ipfsURL + campaign.coverSrcMobile.substring(27, campaign.coverSrcMobile.length) : campaign.coverSrcMobile; this.meta.updateTag({ property: 'og:title', content: campaign.title }); this.meta.updateTag({ property: 'og:description', content: campaign.description }); @@ -292,6 +292,23 @@ export class CampaignDetailsContainerComponent implements OnInit { this.updateMetaTags(campaign); }); } + updateMetaTags(campaign: Campaign) { + if (campaign) { + this.ogImageUrl = campaign.coverSrcMobile.includes('ipfs') + ? ipfsURL + campaign.coverSrcMobile.substring(27, campaign.coverSrcMobile.length) + : campaign.coverSrcMobile; + + this.meta.updateTag({ property: 'og:title', content: campaign.title }); + this.meta.updateTag({ property: 'og:description', content: campaign.description }); + this.meta.updateTag({ property: 'og:image', content: this.ogImageUrl }); + + this.meta.updateTag({ property: 'og:image:width', content: '1200' }); + this.meta.updateTag({ property: 'og:image:height', content: '630' }); + + this.meta.updateTag({ name: 'twitter:card', content: 'summary_large_image' }); + this.meta.updateTag({ name: 'twitter:image', content: this.ogImageUrl }); + } + } imageImported(image: any) { this.campaignsStoreService.updateOneById({ cover: image }); @@ -299,6 +316,7 @@ export class CampaignDetailsContainerComponent implements OnInit { limitDescription(description: string | undefined, maxLength: number = 200): string { return description ? description.slice(0, maxLength) : ''; } + updateMetaTags(campaign: Campaign) { if (campaign) { @@ -310,6 +328,7 @@ export class CampaignDetailsContainerComponent implements OnInit { this.meta.updateTag({ property: 'og:description', content: campaign.description }); this.meta.updateTag({ property: 'og:image', content: this.ogImageUrl }); + this.meta.updateTag({ property: 'og:image:width', content: '1200' }); this.meta.updateTag({ property: 'og:image:height', content: '630' }); diff --git a/src/index.html b/src/index.html index 29e03fc77..d8d50e362 100755 --- a/src/index.html +++ b/src/index.html @@ -25,12 +25,11 @@ - - - SaTT - Smart advertising Transaction Token + + - + --> - - - - - + +