From ba8514d6a22cd70bd24a2794a18e8da0ba6035d1 Mon Sep 17 00:00:00 2001 From: mackt <1033530438@qq.com> Date: Mon, 29 Apr 2024 22:28:14 +0800 Subject: [PATCH] =?UTF-8?q?feat(seo):=20=E6=9C=9F=E5=88=8A=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E3=80=81=E6=9C=9F=E5=88=8A=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/download/page.tsx | 2 +- src/app/layout.tsx | 3 ++- src/app/music/[category]/[[...page]]/page.tsx | 16 +++++++++++----- src/app/vol/[journalId]/page.tsx | 4 ++-- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/app/download/page.tsx b/src/app/download/page.tsx index 22e552b..07c9cfb 100644 --- a/src/app/download/page.tsx +++ b/src/app/download/page.tsx @@ -5,7 +5,7 @@ import DownloadCard from '@/app/download/components/DownloadCard'; import type { Metadata } from 'next'; export const metadata: Metadata = { - title: '下载', + title: 'APP下载', }; const qrCodeList: Array = [ diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 05c8b57..fd6b8e1 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -12,7 +12,8 @@ export const metadata: Metadata = { template: '%s - 雀乐', default: '雀乐', }, - description: '独立 不独于世', + description: + '雀乐是由一群喜欢并热爱独立音乐的人共同创建的,我们致力于传播来自世界各地的独立音乐。我们秉着音乐里独立自主的精神表达内核,希望把雀乐建设成为泛华语地区最好的独立音乐传播平台。', icons: { icon: '/favicon.ico', }, diff --git a/src/app/music/[category]/[[...page]]/page.tsx b/src/app/music/[category]/[[...page]]/page.tsx index 28779e4..c92bf4c 100644 --- a/src/app/music/[category]/[[...page]]/page.tsx +++ b/src/app/music/[category]/[[...page]]/page.tsx @@ -4,11 +4,17 @@ import { notFound } from 'next/navigation'; import { Category, JournalRecommendList, JournalItem, Pagination, RedirectCheck, ButtonFM } from '@/components'; import { apiSearchCategoryList, apiGetJournalRecommendWithCollect, apiJournalList } from '@/services'; -import type { Metadata } from 'next'; - -export const metadata: Metadata = { - title: '期刊', -}; +// export const metadata: Metadata = { +// title: '期刊', +// }; + +export async function generateMetadata({ params: { category } }: { params: { category?: string } }) { + if (category && category !== 'all') { + const categoryList = await getCategoryList(); + const categoryInfo: Category | undefined = categoryList.find((item: Category) => item.nameEn === category); + return { title: categoryInfo?.nameCh, descrition: categoryInfo?.description }; + } +} const getCategoryList = async () => { const result = await apiSearchCategoryList(); diff --git a/src/app/vol/[journalId]/page.tsx b/src/app/vol/[journalId]/page.tsx index 067b3b3..044906b 100644 --- a/src/app/vol/[journalId]/page.tsx +++ b/src/app/vol/[journalId]/page.tsx @@ -6,8 +6,8 @@ import { apiGetJournalInfoById, apiGetSongsByJournalNo, apiGetJournalRecommendBy export async function generateMetadata({ params: { journalId } }: { params: { journalId: string } }) { const res = await apiGetJournalInfoById({ id: journalId }); - const title = res.code === 200 ? res.data.title : '期刊详情'; - return { title }; + const journalInfo = res.data; + return { title: journalInfo.title, descrition: journalInfo.summary }; } const getData = async (journalId: string) => {