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

fix: opengraph on base route #338

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions ogi/components/OgImage/base-image.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<script setup lang="ts">
import type { CSSProperties } from 'vue'
import { KODA_LOGO_URL } from '@/utils/constants'

// inherited attrs can mess up the satori parser
defineOptions({
inheritAttrs: false,
})

defineProps<{
image: string
}>()

const cover: ComputedRef<CSSProperties> = computed(() => {
return {
objectFit: 'cover',
objectPosition: 'center',
}
})
</script>

<template>
<img
:src="image"
:alt="text"
:style="cover"
class="h-full w-full"
/>
</template>
15 changes: 9 additions & 6 deletions ogi/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<template>
<div>
<NuxtWelcome />
</div>
<div></div>
</template>

<script lang="ts" setup>
Expand All @@ -10,10 +8,15 @@ const route = useRoute()
const { image, text } = route.query

defineOgImage({
component: 'base',
component: 'base-image',
props: {
text: text,
image: image,
image: KODA_BANNER_URL,
},
})

useSeoMeta({
title: seoTitle('Koda'),
description: KODA_DESCRIPTION,
twitterCard: 'summary_large_image',
})
</script>
5 changes: 4 additions & 1 deletion ogi/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@

export const KODA_LOGO_URL = 'https://raw.githubusercontent.com/kodadot/nft-gallery/main/public/koda_logo_fill.png';

export const KODA_BANNER_URL = 'https://raw.githubusercontent.com/kodadot/nft-gallery/main/public/k_card.png'

export const KODA_DESCRIPTION = 'One stop place for all your generative art needs'
4 changes: 2 additions & 2 deletions services/image/src/tests/type-endpoint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ test('type-endpoint - 302 - image', async () => {
expect(data).toMatchInlineSnapshot(`
Blob {
Symbol(kHandle): Blob {},
Symbol(kLength): 86738,
Symbol(kLength): 86717,
Symbol(kType): "image/png",
}
`)
Expand All @@ -88,7 +88,7 @@ test('type-endpoint - 200 - image - original', async () => {
expect(data).toMatchInlineSnapshot(`
Blob {
Symbol(kHandle): Blob {},
Symbol(kLength): 86783,
Symbol(kLength): 86670,
Symbol(kType): "image/png",
}
`)
Expand Down
Loading