Skip to content

Commit 5a50e97

Browse files
authored
feat: Bump @nuxtjs/seo (#107)
1 parent 9db0669 commit 5a50e97

File tree

8 files changed

+457
-129
lines changed

8 files changed

+457
-129
lines changed

app/components/FAQ.vue

-42
This file was deleted.

app/components/content/Writing.vue

+4-5
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,23 @@ const { locale } = useI18n()
1212
const slug = computed(() => withLeadingSlash(String(route.params.slug)))
1313
const { data: articles } = await useAsyncData('articles-' + slug.value, async () => {
1414
const collection = ('articles_' + locale.value) as keyof Collections
15-
return await queryCollection(collection).all()
15+
return await queryCollection(collection).all() as Collections['articles_en'][] | Collections['articles_fr'][]
1616
}, {
1717
watch: [locale],
1818
})
19-
console.log(articles.value)
2019
2120
if (!articles.value)
2221
throw createError({ statusCode: 404, statusMessage: 'Page not found' })
2322
2423
const tags = computed(() =>
25-
Array.from(new Set(articles.value.flatMap(article => article.tags))),
24+
Array.from(new Set(articles.value?.flatMap(article => article.tags))),
2625
)
2726
2827
const filteredArticles = computed(() =>
29-
articles.value.filter(article =>
28+
articles.value?.filter(article =>
3029
(searchedTags.value.length === 0 || searchedTags.value.some(tag => article.tags.includes(tag)))
3130
&& (searchedTitle.value === '' || article.title!.toLowerCase().includes(searchedTitle.value.toLowerCase())),
32-
),
31+
) ?? [],
3332
)
3433
3534
const toggleTag = (tag: string) => {

app/components/home/Faq.vue

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<script setup lang="ts">
22
import { withLeadingSlash } from 'ufo'
3+
import type { Collections } from '@nuxt/content'
34
45
const route = useRoute()
56
const { locale } = useI18n()
67
78
const slug = computed(() => withLeadingSlash(String(route.params.slug)))
89
const { data: faq } = await useAsyncData('faq-' + slug.value, async () => {
9-
const collection = ('faq_' + locale.value)
10-
return await queryCollection(collection).first()
10+
const collection = ('faq_' + locale.value) as keyof Collections
11+
return await queryCollection(collection).first() as Collections['faq_en'] | Collections['faq_fr']
1112
}, {
1213
watch: [locale],
1314
})
@@ -58,7 +59,7 @@ const ui = {
5859
:items="item.questions"
5960
:ui="{
6061
item: 'mb-2 group px-4 transform-gpu rounded-xl border border-white/10 bg-white/5 transition duration-500 will-change-transform hover:bg-white/[0.075]',
61-
trailingIcon: 'group-data-[state=closed]:rotate-45 group-data-[state=open]:rotate-180',
62+
trailingIcon: 'group-data-[state=closed]:rotate-0 group-data-[state=open]:rotate-135',
6263
}"
6364
/>
6465
</template>

content.config.ts

+55-42
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { defineCollection, z } from '@nuxt/content'
2+
import { asSeoCollection } from '@nuxtjs/seo/content'
23

34
const commonContentSchema = z.object({
45
title: z.string().nonempty(),
@@ -41,48 +42,60 @@ const commonFaqSchema = z.object({
4142
})
4243

4344
export const collections = {
44-
content_en: defineCollection({
45-
type: 'page',
46-
source: {
47-
include: 'en/**/*.md',
48-
prefix: '/',
49-
},
50-
schema: commonContentSchema,
51-
}),
52-
content_fr: defineCollection({
53-
type: 'page',
54-
source: {
55-
include: 'fr/**/*.md',
56-
prefix: '/',
57-
},
58-
schema: commonContentSchema,
59-
}),
60-
articles_en: defineCollection({
61-
type: 'page',
62-
source: {
63-
include: 'en/articles/*.md',
64-
prefix: '/articles',
65-
},
66-
schema: commonArticleSchema,
67-
}),
68-
articles_fr: defineCollection({
69-
type: 'page',
70-
source: {
71-
include: 'fr/articles/*.md',
72-
prefix: '/articles',
73-
},
74-
schema: commonArticleSchema,
75-
}),
76-
projects_en: defineCollection({
77-
type: 'data',
78-
source: 'en/projects/*.json',
79-
schema: commonProjectSchema,
80-
}),
81-
projects_fr: defineCollection({
82-
type: 'data',
83-
source: 'fr/projects/*.json',
84-
schema: commonProjectSchema,
85-
}),
45+
content_en: defineCollection(
46+
asSeoCollection({
47+
type: 'page',
48+
source: {
49+
include: 'en/**/*.md',
50+
prefix: '/',
51+
},
52+
schema: commonContentSchema,
53+
}),
54+
),
55+
content_fr: defineCollection(
56+
asSeoCollection({
57+
type: 'page',
58+
source: {
59+
include: 'fr/**/*.md',
60+
prefix: '/',
61+
},
62+
schema: commonContentSchema,
63+
}),
64+
),
65+
articles_en: defineCollection(
66+
asSeoCollection({
67+
type: 'page',
68+
source: {
69+
include: 'en/articles/*.md',
70+
prefix: '/articles',
71+
},
72+
schema: commonArticleSchema,
73+
}),
74+
),
75+
articles_fr: defineCollection(
76+
asSeoCollection({
77+
type: 'page',
78+
source: {
79+
include: 'fr/articles/*.md',
80+
prefix: '/articles',
81+
},
82+
schema: commonArticleSchema,
83+
}),
84+
),
85+
projects_en: defineCollection(
86+
asSeoCollection({
87+
type: 'data',
88+
source: 'en/projects/*.json',
89+
schema: commonProjectSchema,
90+
}),
91+
),
92+
projects_fr: defineCollection(
93+
asSeoCollection({
94+
type: 'data',
95+
source: 'fr/projects/*.json',
96+
schema: commonProjectSchema,
97+
}),
98+
),
8699
stack: defineCollection({
87100
type: 'data',
88101
source: 'stack.json',

nuxt.config.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ export default defineNuxtConfig({
33
'@vueuse/nuxt',
44
'@nuxtjs/i18n',
55
'@nuxt/ui',
6+
'@nuxtjs/seo',
67
'@nuxt/content',
78
'@nuxt/image',
8-
'nuxt-og-image',
9-
'@nuxt/fonts',
109
'@nuxt/scripts',
1110
],
1211

@@ -40,8 +39,8 @@ export default defineNuxtConfig({
4039
renderer: {
4140
anchorLinks: false,
4241
},
43-
studio: {
44-
enabled: true,
42+
preview: {
43+
api: 'https://api.nuxt.studio',
4544
dev: true,
4645
},
4746
},
@@ -111,4 +110,8 @@ export default defineNuxtConfig({
111110
},
112111
provider: 'iconify',
113112
},
113+
114+
ogImage: {
115+
zeroRuntime: true,
116+
},
114117
})

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
"@nuxt/scripts": "0.9.5",
2424
"@nuxt/ui": "3.0.0-alpha.11",
2525
"@nuxtjs/i18n": "9.1.1",
26+
"@nuxtjs/seo": "^2.1.0",
2627
"@vueuse/core": "12.4.0",
2728
"@vueuse/nuxt": "12.4.0",
2829
"nuxt": "3.15.2",
29-
"nuxt-og-image": "4.0.2",
3030
"resend": "4.0.1",
3131
"sitemap": "8.0.0",
3232
"vue-sonner": "1.3.0"

0 commit comments

Comments
 (0)