From 8aa242acfcbe8b13e97d09896130de092df92070 Mon Sep 17 00:00:00 2001 From: markthree <1801982702@qq.com> Date: Fri, 7 Apr 2023 21:25:18 +0800 Subject: [PATCH] chore: Enhanced SEO --- nuxt.config.ts | 7 +++++++ package.json | 1 + pnpm-lock.yaml | 13 +++++++++++++ robots.config.ts | 8 ++++++++ 4 files changed, 29 insertions(+) create mode 100644 robots.config.ts diff --git a/nuxt.config.ts b/nuxt.config.ts index a461b44..bb36503 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -15,12 +15,19 @@ export default defineNuxtConfig({ 'nuxt-size', '@unocss/nuxt', '@nuxt/devtools', + '@nuxtjs/robots', '@nuxtjs/fontaine', '@nuxt/image-edge', './modules/beastcss' ], app: { head: { + meta: [ + { charset: 'utf-8' }, + { name: 'keywords', content: '编程快速入门视频' }, + { name: 'keywords', content: '帮助你快速开始编程的教程' }, + { name: 'description', content: `一个编程快速入门的视频栏目,帮助你快速开始编程` }, + ], htmlAttrs: { lang: 'zh-CN' } diff --git a/package.json b/package.json index e89878b..d048986 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "@nuxt/image-edge": "1.0.0-28008586.381b906", "@nuxt/kit": "^3.3.3", "@nuxtjs/fontaine": "^0.2.4", + "@nuxtjs/robots": "^3.0.0", "@types/node": "^18.15.11", "@unocss/nuxt": "^0.50.6", "beastcss": "^2.1.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f44b9aa..0afea81 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,6 +22,9 @@ devDependencies: '@nuxtjs/fontaine': specifier: ^0.2.4 version: 0.2.4(rollup@3.20.2) + '@nuxtjs/robots': + specifier: ^3.0.0 + version: 3.0.0(rollup@3.20.2) '@types/node': specifier: ^18.15.11 version: 18.15.11 @@ -1589,6 +1592,16 @@ packages: - supports-color dev: true + /@nuxtjs/robots@3.0.0(rollup@3.20.2): + resolution: {integrity: sha512-qsHGW1KXBvV5Kq7u3huPnFCUTbHS4Fk8Za2mNPgmUXcwLgp3exvhPtdZfIdjrCF/aZk3A8OZONNmGghs6CecBA==} + dependencies: + '@nuxt/kit': 3.3.3(rollup@3.20.2) + h3: 1.6.4 + transitivePeerDependencies: + - rollup + - supports-color + dev: true + /@polka/url@1.0.0-next.21: resolution: {integrity: sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==} dev: true diff --git a/robots.config.ts b/robots.config.ts new file mode 100644 index 0000000..c2a634f --- /dev/null +++ b/robots.config.ts @@ -0,0 +1,8 @@ +export default [ + { UserAgent: '*' }, + { Disallow: '/' }, + { BlankLine: true }, + { Comment: 'Comment here' }, + // @ts-ignore + { Sitemap: (req) => `https://${req.headers.host}/sitemap.xml` } +] \ No newline at end of file