Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meta property content #582

Merged
merged 11 commits into from
Sep 29, 2023
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@


<head>

<!-- <head>
<meta property="og:title" content="{{ 'campaign?.title' }}" />
<meta property="og:description" content="{{ 'campaign?.summary' }}" />
<meta property="og:image" content="{{ 'ogImageUrl' }}" />

<!-- <meta property="og:title" [attr.content]="campaign?.title" />
<meta property="og:title" [attr.content]="campaign?.title" />
<meta property="og:description" [attr.content]="limitDescription(campaign?.summary)" />
<meta property="og:image" [attr.content]="ogImageUrl" /> -->
<meta property="og:image" [attr.content]="ogImageUrl" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />

</head>
</head> -->






<ng-container *ngIf="campaign?.id === campaignId; else loading">
<div class="content" style="min-height: 50vh">
<router-outlet></router-outlet>
</div>
</ng-container>
<ng-template #loading>

<app-loading-logo> </app-loading-logo>
<app-loading-logo> </app-loading-logo>
</ng-template>
<!-- <div
*ngIf="this.showmoonboy"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ export class CampaignDetailsContainerComponent implements OnInit {
)
.subscribe();
this.campaign$ = this.campaignsStoreService.campaign$;
// this.meta.updateTag({ property: 'og:title', content: this.campaign.title });
// this.meta.updateTag({
// property: 'og:description',
// content: this.campaign.description
// });
// this.meta.updateTag({ property: 'og:image', content: this.ogImageUrl });
/*if (isPlatformServer(this.platformId)) {
this.meta.addTag({
name: 'og:image:secure_url',
Expand Down Expand Up @@ -146,12 +152,7 @@ export class CampaignDetailsContainerComponent implements OnInit {
setTimeout(() => {
this.showmoonboy = campaign.id === this.campaignId;
}, 1000);
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.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 });
Expand Down Expand Up @@ -288,6 +289,7 @@ export class CampaignDetailsContainerComponent implements OnInit {
},
`name='twitter'`
);*/
this.updateMetaTags(campaign);
});
}

Expand All @@ -297,21 +299,36 @@ export class CampaignDetailsContainerComponent implements OnInit {
limitDescription(description: string | undefined, maxLength: number = 200): string {
return description ? description.slice(0, maxLength) : '';
}

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 });
}
}

ngOnDestroy(): void {
// Remove or update any additional meta tags when the component is destroyed
this.meta.updateTag({ name: 'og:title', content: '' });
this.meta.updateTag({ name: 'og:image', content: '' });
this.meta.updateTag({ name: 'og:description', content: '' });
this.meta.updateTag({ name: 'og:type', content: '' });
this.meta.updateTag({ name: 'twitter:card', content: '' });

this.isDestroyed.next('');
this.isDestroyed.unsubscribe();
this.campaignsStoreService.clearDataStore();
// location.reload();
this.meta.updateTag({ name: 'og:title', content: '' }, `name='og:title'`);
this.meta.updateTag({ name: 'og:image', content: '' }, `name='og:image'`);
this.meta.updateTag(
{ name: 'og:description', content: '' },
`name='og:description'`
);
this.meta.updateTag({ name: 'og:type', content: '' }, `name='og:type'`);
this.meta.updateTag(
{ name: 'twitter:card', content: '' },
`name='twitter:card'`
);
}

}
6 changes: 3 additions & 3 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="#1f2337" />
<meta name="twitter:card" content="summary">



<title>SaTT - Smart advertising Transaction Token</title>

<!-- <title>SaTT - Smart advertising Transaction Token</title> -->


<base href="/" />
<meta
Expand All @@ -46,6 +45,7 @@
<meta property="og:image" content="https://satt-token.com/assets/img/share_img_200px.png" />
<meta property="og:title" content="SaTT - Smart advertising Transaction Token" />
-->


<meta name="keyword" content="crypto, blockchain, social media, farming, earning crypto, profitable, marketing, influencers, brand, SaTT, token, Trust, wallet">

Expand Down