From 3f9e39d2448d55f7d343e2dbcb601e2b74fe8399 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 11 Jan 2023 22:42:52 +0000 Subject: [PATCH] chore: add basic open graph metadata --- app.vue | 9 +++++++++ nuxt.config.ts | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/app.vue b/app.vue index 31cc43a1..cc034a6b 100644 --- a/app.vue +++ b/app.vue @@ -2,6 +2,15 @@ setupPageHeader() provideGlobalCommands() +const route = useRoute() +if (process.server && !route.path.startsWith('/settings')) { + useHead({ + meta: [ + { property: 'og:url', content: `https://elk.zone${route.path}` }, + ], + }) +} + // We want to trigger rerendering the page when account changes const key = computed(() => `${currentUser.value?.server ?? currentServer.value}:${currentUser.value?.account.id || ''}`) diff --git a/nuxt.config.ts b/nuxt.config.ts index 9d1ed396..3b1cd2e7 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -132,6 +132,14 @@ export default defineNuxtConfig({ ], meta: [ { name: 'apple-mobile-web-app-status-bar-style', content: 'black-translucent' }, + // open graph social image + { property: 'og:title', content: 'Elk' }, + { property: 'og:type', content: 'website' }, + { property: 'og:image', content: 'https://elk.zone/elk-og.png' }, + { property: 'og:image:width', content: '3800' }, + { property: 'og:image:height', content: '1900' }, + { property: 'og:site_name', content: 'Elk' }, + { property: 'twitter:site', content: '@elk_zone' }, ], }, },