From cb32830348c1689bc7fa4304699c7aaa7251e851 Mon Sep 17 00:00:00 2001 From: HugoRCD Date: Tue, 21 Jan 2025 21:31:01 +0100 Subject: [PATCH] feat: update nuxt seo --- content.config.ts | 85 +++++++++++++++++++++++++---------------------- nuxt.config.ts | 29 ++++++---------- public/robots.txt | 3 -- 3 files changed, 56 insertions(+), 61 deletions(-) delete mode 100644 public/robots.txt diff --git a/content.config.ts b/content.config.ts index 408109a..f8c3090 100644 --- a/content.config.ts +++ b/content.config.ts @@ -1,46 +1,53 @@ import { defineCollection, z } from '@nuxt/content' +import { asSeoCollection } from '@nuxtjs/seo/content' export const collections = { - content: defineCollection({ - type: 'page', - source: [ - { - include: '**/*.md', - prefix: '/' - }, - { - repository: 'https://github.com/HugoRCD/notes', - include: '*.md', - prefix: '/notes', - authToken: process.env.NUXT_PRIVATE_GITHUB_TOKEN, - } - ], - schema: z.object({ - title: z.string().nonempty(), - description: z.string().nonempty(), - date: z.string().nonempty(), + content: defineCollection( + asSeoCollection({ + type: 'page', + source: [ + { + include: '**/*.md', + prefix: '/' + }, + { + repository: 'https://github.com/HugoRCD/notes', + include: '*.md', + prefix: '/notes', + authToken: process.env.NUXT_PRIVATE_GITHUB_TOKEN, + } + ], + schema: z.object({ + title: z.string().nonempty(), + description: z.string().nonempty(), + date: z.string().nonempty(), + }) }) - }), - writing: defineCollection({ - type: 'page', - source: '2.writing/*.md', - schema: z.object({ - title: z.string().nonempty(), - description: z.string().nonempty(), - date: z.string().nonempty(), + ), + writing: defineCollection( + asSeoCollection({ + type: 'page', + source: '2.writing/*.md', + schema: z.object({ + title: z.string().nonempty(), + description: z.string().nonempty(), + date: z.string().nonempty(), + }) }) - }), - works: defineCollection({ - type: 'data', - source: '1.works/*.json', - schema: z.object({ - name: z.string().nonempty(), - logo: z.string().nonempty(), - description: z.string().nonempty(), - image: z.string().url(), - link: z.string().url(), - release: z.string().nonempty(), - date: z.string().nonempty(), + ), + works: defineCollection( + asSeoCollection({ + type: 'data', + source: '1.works/*.json', + schema: z.object({ + name: z.string().nonempty(), + logo: z.string().nonempty(), + description: z.string().nonempty(), + image: z.string().url(), + link: z.string().url(), + release: z.string().nonempty(), + date: z.string().nonempty(), + }) }) - }) + ) } diff --git a/nuxt.config.ts b/nuxt.config.ts index 99c6d46..93ef1ac 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -13,9 +13,9 @@ export default defineNuxtConfig({ indexable: true, }, - /*robots: { + robots: { disallow: ['/notes'], - },*/ + }, routeRules: { '/': { isr: true }, @@ -23,11 +23,11 @@ export default defineNuxtConfig({ modules: [ 'mockline', + '@nuxtjs/seo', '@nuxt/content', '@nuxt/image', '@nuxt/scripts', - '@vueuse/nuxt', - '@nuxtjs/seo' + '@vueuse/nuxt' ], colorMode: { @@ -36,16 +36,7 @@ export default defineNuxtConfig({ }, sitemap: { - enabled: false - }, - robots: { - enabled: false - }, - schemaOrg: { - enabled: false - }, - linkChecker: { - enabled: false + exclude: ['/notes'], }, content: { @@ -56,10 +47,10 @@ export default defineNuxtConfig({ } }, }, - studio: { - enabled: true, - dev: true - } + preview: { + api: 'https://api.nuxt.studio', + dev: true, + }, }, runtimeConfig: { @@ -75,7 +66,7 @@ export default defineNuxtConfig({ nitro: { prerender: { crawlLinks: true, - routes: ['/', '/works', '/about', '/writing'], + routes: ['/', 'sitemap', '/works', '/about', '/writing'], ignore: ['/notes', '/notes/**'], }, }, diff --git a/public/robots.txt b/public/robots.txt deleted file mode 100644 index 95c08d0..0000000 --- a/public/robots.txt +++ /dev/null @@ -1,3 +0,0 @@ -User-agent: * -Allow: / -Disallow: /notes/