Skip to content

Commit 8b5bfc6

Browse files
authored
Merge pull request #338 from kodadot/ogi-fix--opengraph-on-base-route
fix: opengraph on base route
2 parents 1d2c008 + 5ea0688 commit 8b5bfc6

File tree

4 files changed

+44
-9
lines changed

4 files changed

+44
-9
lines changed

ogi/components/OgImage/base-image.vue

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<script setup lang="ts">
2+
import type { CSSProperties } from 'vue'
3+
import { KODA_LOGO_URL } from '@/utils/constants'
4+
5+
// inherited attrs can mess up the satori parser
6+
defineOptions({
7+
inheritAttrs: false,
8+
})
9+
10+
defineProps<{
11+
image: string
12+
}>()
13+
14+
const cover: ComputedRef<CSSProperties> = computed(() => {
15+
return {
16+
objectFit: 'cover',
17+
objectPosition: 'center',
18+
}
19+
})
20+
</script>
21+
22+
<template>
23+
<img
24+
:src="image"
25+
:alt="text"
26+
:style="cover"
27+
class="h-full w-full"
28+
/>
29+
</template>

ogi/pages/index.vue

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<template>
2-
<div>
3-
<NuxtWelcome />
4-
</div>
2+
<div></div>
53
</template>
64

75
<script lang="ts" setup>
@@ -10,10 +8,15 @@ const route = useRoute()
108
const { image, text } = route.query
119
1210
defineOgImage({
13-
component: 'base',
11+
component: 'base-image',
1412
props: {
15-
text: text,
16-
image: image,
13+
image: KODA_BANNER_URL,
1714
},
1815
})
16+
17+
useSeoMeta({
18+
title: seoTitle('Koda'),
19+
description: KODA_DESCRIPTION,
20+
twitterCard: 'summary_large_image',
21+
})
1922
</script>

ogi/utils/constants.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
21
export const KODA_LOGO_URL = 'https://raw.githubusercontent.com/kodadot/nft-gallery/main/public/koda_logo_fill.png';
2+
3+
export const KODA_BANNER_URL = 'https://raw.githubusercontent.com/kodadot/nft-gallery/main/public/k_card.png'
4+
5+
export const KODA_DESCRIPTION = 'One stop place for all your generative art needs'

services/image/src/tests/type-endpoint.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ test('type-endpoint - 302 - image', async () => {
6969
expect(data).toMatchInlineSnapshot(`
7070
Blob {
7171
Symbol(kHandle): Blob {},
72-
Symbol(kLength): 86738,
72+
Symbol(kLength): 86717,
7373
Symbol(kType): "image/png",
7474
}
7575
`)
@@ -88,7 +88,7 @@ test('type-endpoint - 200 - image - original', async () => {
8888
expect(data).toMatchInlineSnapshot(`
8989
Blob {
9090
Symbol(kHandle): Blob {},
91-
Symbol(kLength): 86783,
91+
Symbol(kLength): 86670,
9292
Symbol(kType): "image/png",
9393
}
9494
`)

0 commit comments

Comments
 (0)