generated from Pinegrow/pg-nuxtui-shadcn-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.vue
77 lines (69 loc) · 2.21 KB
/
app.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<script setup lang="ts">
import site from '@/site'
import { heroImageUrl } from '@/utils/hero'
import { primary, secondary } from '@/utils/colors'
// import { useSiteConfig } from '#imports'
// const siteConfig = useSiteConfig()
// When building as a SSG (generate command) app, defineRobotMeta is used to create a meta tag to control indexing. For more details - https://nuxtseo.com/robots/guides/meta-tags
// TODO: Remove below defineRobotMeta if building as a SSR (build command) app
defineRobotMeta()
const { name, logo, description, author, twitter } = site
const fromBg = secondary
const toBg = primary
const ogImageOptions = {
component: 'ThePage',
title: name,
// description: '', // use page description instead
summary: description,
fromBg,
toBg,
// image: '~/assets/images/hero1.jpg',
logo,
author,
twitter,
}
// https://nuxtseo.com/schema-org/guides/quick-setup
useSchemaOrg([
defineWebSite({
name: site.name,
}),
defineWebPage(),
])
const route = useRoute()
const ogImage = computed(() => (route.meta.ogImage || heroImageUrl) as string)
const { optimizeImage } = useOptimizeImage()
const theOgImageOptimized = {
alt: `hero`,
cover: true,
...optimizeImage(
ogImage.value,
/* options */
{
modifiers: {
width: 1200,
height: 600,
fit: 'fill', // can be cover, contain, fill, inside, outside
},
/* If using local images instead of unsplash url, enable netlify provider */
// provider:
// process.env.NODE_ENV === 'production'
// ? 'netlify'
// : null /* defaults to ipx or ipxStatic */,
placeholder: false, // placeholder image before the actual image is fully loaded.
},
),
}
const theOgImage = theOgImageOptimized.src
</script>
<template>
<div>
<HeadAndMeta />
<!-- We pass image separately so that alias can be transformed by vue plugin, see vite.vue.template.transformAssetUrls in nuxt.config.ts -->
<OgImage :image="theOgImage" v-bind="ogImageOptions" />
<NuxtLoadingIndicator />
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
</div>
</template>
<style></style>