Skip to content

Commit

Permalink
wip checknew method for share link meta og tag (#565)
Browse files Browse the repository at this point in the history
  • Loading branch information
hichri-louay authored Sep 26, 2023
1 parent 05b2ae6 commit b6c41cc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@

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


<ng-container *ngIf="campaign?.id === campaignId; else loading">
<div class="content" style="min-height: 50vh">
<router-outlet></router-outlet>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class CampaignDetailsContainerComponent implements OnInit {
private isDestroyed = new Subject();

constructor(

private campaignsStoreService: CampaignsStoreService,
private route: ActivatedRoute,
private meta: Meta,
Expand Down Expand Up @@ -54,7 +55,7 @@ export class CampaignDetailsContainerComponent implements OnInit {
)
.subscribe();
this.campaign$ = this.campaignsStoreService.campaign$;
if (isPlatformServer(this.platformId)) {
/*if (isPlatformServer(this.platformId)) {
this.meta.addTag({
name: 'og:image:secure_url',
content: ``
Expand Down Expand Up @@ -138,7 +139,7 @@ export class CampaignDetailsContainerComponent implements OnInit {
name: 'twitter:image',
content: 'https://safeimagekit.com/picture.png'
});
}
}*/

this.campaign$.pipe(takeUntil(this.isDestroyed)).subscribe((campaign) => {
this.campaign = campaign;
Expand All @@ -147,14 +148,16 @@ export class CampaignDetailsContainerComponent implements OnInit {
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 });
this.meta.updateTag({ property: 'og:image', content: this.ogImageUrl });

this.meta.updateTag(
/*this.meta.updateTag(
{
itemprop: 'image',
property: 'og:image',
content: this.ogImageUrl
},
`itemprop='image'`
);
this.meta.updateTag(
Expand Down Expand Up @@ -279,7 +282,7 @@ export class CampaignDetailsContainerComponent implements OnInit {
content: this.ogImageUrl
},
`name='twitter'`
);
);*/
});
}

Expand Down

0 comments on commit b6c41cc

Please sign in to comment.