Skip to content

Commit 35e793c

Browse files
Resolved issue kodadot#288:
Added og:title, og:image, og:video, twitter:title, twitter:card metadata properties in order to add image of the last mint from a user and their username on open graph display cards. Also added @edgeware/node-types due to having issues with yarn serve complaining about the package not existing.
1 parent 9f69229 commit 35e793c

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

dashboard/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"start": "vue-cli-service serve"
1111
},
1212
"dependencies": {
13+
"@edgeware/node-types": "^3.3.4",
1314
"@fortawesome/fontawesome-svg-core": "^1.2.34",
1415
"@fortawesome/free-brands-svg-icons": "^5.15.2",
1516
"@fortawesome/free-regular-svg-icons": "^5.15.2",

dashboard/src/views/Profile.vue

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
icon="ghost"
1010
></b-icon>
1111
<a :href="`https://kusama.subscan.io/account/${id}`" target="_blank"
12-
><Identity :address="id" :inline="true"
12+
><Identity ref="identity" :address="id" :inline="true"
1313
/></a>
1414
</p>
1515
<Sharing v-if="!sharingVisible" label="Check this awesome Profile on %23KusamaNetwork %23KodaDot" :iframe="iframeSettings" />
@@ -32,20 +32,20 @@
3232
</template>
3333

3434
<script lang="ts">
35-
import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
35+
import { Component, Vue } from 'vue-property-decorator';
3636
import { getInstance } from '@/components/rmrk/service/RmrkService';
3737
import { notificationTypes, showNotification } from '@/utils/notification';
3838
import {
3939
defaultSortBy,
4040
sanitizeObjectArray
4141
} from '@/components/rmrk/utils';
4242
import {
43-
Collection,
4443
CollectionWithMeta,
4544
NFTWithMeta,
4645
Pack
4746
} from '@/components/rmrk/service/scheme';
4847
import isShareMode from '@/utils/isShareMode';
48+
import Identity from '../components/shared/format/Identity.vue';
4949
5050
const components = {
5151
GalleryCardList: () => import('@/components/rmrk/Gallery/GalleryCardList.vue'),
@@ -55,7 +55,23 @@ const components = {
5555
5656
const eq = (tab: string) => (el: string) => tab === el
5757
58-
@Component({ components })
58+
@Component<Profile>({
59+
components,
60+
metaInfo() {
61+
return {
62+
meta: [
63+
{ property: 'og:title', content: this.name },
64+
{ property: 'og:type', content: 'website'},
65+
{ property: 'og:image', vmid: 'og:image', content: this.firstNFT as string},
66+
{ property: 'og:video', vmid: 'og:video' , content: this.firstNFT as string },
67+
{ property: 'twitter:title', content: this.name },
68+
{ property: 'twitter:image', vmid: 'twitter:image', content: this.firstNFT as string },
69+
{ property: 'twitter:card', content: 'summary_large_image' },
70+
]
71+
};
72+
},
73+
74+
})
5975
export default class Profile extends Vue {
6076
public activeTab: string = 'nft';
6177
protected id: string = '';
@@ -114,12 +130,19 @@ export default class Profile extends Vue {
114130
return { width: '100%', height: '100vh', customUrl: this.customUrl }
115131
}
116132
133+
get firstNFT() {
134+
return !!this.nfts[0] && !!this.nfts[0].image ? this.nfts[0].image : '';
135+
}
136+
137+
get name() {
138+
return ((this.$refs['identity'] as Identity).name as string);
139+
}
140+
117141
public checkActiveTab() {
118142
if (this.$route.params.tab && ['nft', 'collection', 'pack'].some(eq(this.$route.params.tab))) {
119143
this.activeTab = this.$route.params.tab;
120144
}
121145
}
122-
123146
}
124147
</script>
125148

0 commit comments

Comments
 (0)