@studio-fes/layer-strapi 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { SeoMetaFragment } from '~/types/graphql-operations'
|
|
2
2
|
|
|
3
|
+
function getFallbackImage(): string | null {
|
|
4
|
+
const runtimeConfig = useRuntimeConfig()
|
|
5
|
+
const nuxtImage = useImage()
|
|
6
|
+
return nuxtImage(`/${runtimeConfig.public.ogImageFallback}`, { width: 1200, height: 630, quality: 80 })
|
|
7
|
+
}
|
|
8
|
+
|
|
3
9
|
export function useStrapiSEO(seoData?: MaybeRefOrGetter<SeoMetaFragment>) {
|
|
4
10
|
const runtimeConfig = useRuntimeConfig()
|
|
5
11
|
const nuxtImage = useImage()
|
|
@@ -10,13 +16,18 @@ export function useStrapiSEO(seoData?: MaybeRefOrGetter<SeoMetaFragment>) {
|
|
|
10
16
|
|
|
11
17
|
const { metaTitle, metaDescription, metaImage, openGraph, metaRobots, keywords } = toValue(seoData)
|
|
12
18
|
|
|
19
|
+
const ogImageData = openGraph?.ogImage || metaImage
|
|
20
|
+
const ogImage = ogImageData?.url
|
|
21
|
+
? nuxtImage(runtimeConfig.public.backendUrl + ogImageData.url, { width: 1200, height: 630, quality: 80 })
|
|
22
|
+
: getFallbackImage()
|
|
23
|
+
|
|
13
24
|
useSeoMeta({
|
|
14
25
|
title: metaTitle,
|
|
15
26
|
description: metaDescription,
|
|
16
|
-
ogImage
|
|
27
|
+
ogImage,
|
|
17
28
|
ogTitle: openGraph?.ogTitle || metaTitle,
|
|
18
29
|
ogDescription: openGraph?.ogDescription || metaDescription,
|
|
19
|
-
ogImageAlt:
|
|
30
|
+
ogImageAlt: ogImageData?.alternativeText || metaTitle,
|
|
20
31
|
twitterCard: 'summary_large_image',
|
|
21
32
|
robots: metaRobots,
|
|
22
33
|
keywords,
|
|
@@ -5,13 +5,13 @@ export function parseStrapiImage(image: StrapiFileFragment | undefined): NuxtImg
|
|
|
5
5
|
if (!image)
|
|
6
6
|
return null
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const config = useRuntimeConfig()
|
|
9
9
|
const { width, height, url: src, alternativeText: alt } = image
|
|
10
10
|
|
|
11
11
|
return {
|
|
12
12
|
width,
|
|
13
13
|
height,
|
|
14
|
-
src:
|
|
14
|
+
src: `${config.public.backendUrl}${src}`,
|
|
15
15
|
alt,
|
|
16
16
|
} as {
|
|
17
17
|
width: number
|
|
@@ -5,12 +5,12 @@ export function parseStrapiVideo(video: StrapiFileFragment | null | undefined):
|
|
|
5
5
|
if (!video)
|
|
6
6
|
return {}
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const config = useRuntimeConfig()
|
|
9
9
|
const id = useId()
|
|
10
10
|
|
|
11
11
|
return {
|
|
12
12
|
id: `video-${id}`,
|
|
13
|
-
src:
|
|
13
|
+
src: `${config.public.backendUrl}${video.url}`,
|
|
14
14
|
width: video.width,
|
|
15
15
|
height: video.height,
|
|
16
16
|
}
|
package/nuxt.config.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studio-fes/layer-strapi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.1",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@nuxt/eslint": "latest",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"nuxt": "^4.4.8",
|
|
16
16
|
"typescript": "^6.0.3",
|
|
17
17
|
"vue": "latest",
|
|
18
|
-
"@studio-fes/layer-base": "0.3.
|
|
18
|
+
"@studio-fes/layer-base": "0.3.1"
|
|
19
19
|
},
|
|
20
20
|
"description": "Create Nuxt extendable layer with this GitHub template.",
|
|
21
21
|
"repository": {
|