From 1c9aba2a332ed5a8e305a5ce1a3deedb2b0803e7 Mon Sep 17 00:00:00 2001 From: Innei Date: Tue, 12 Mar 2024 19:11:49 +0800 Subject: [PATCH] feat: add feed metadata Signed-off-by: Innei --- src/app/(app)/layout.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/app/(app)/layout.tsx b/src/app/(app)/layout.tsx index 5a523ec3bf..8cc6ea5972 100644 --- a/src/app/(app)/layout.tsx +++ b/src/app/(app)/layout.tsx @@ -1,7 +1,7 @@ /* eslint-disable no-console */ import { cache } from 'react' import { ToastContainer } from 'react-toastify' -import type { Viewport } from 'next' +import type { Metadata, Viewport } from 'next' import type { PropsWithChildren } from 'react' import { ClerkProvider } from '@clerk/nextjs' @@ -58,7 +58,7 @@ const fetchAggregationData = cache(async () => { revalidate, ) }) -export const generateMetadata = async () => { +export const generateMetadata = async (): Promise => { const fetchedData = await fetchAggregationData() const { @@ -129,7 +129,14 @@ export const generateMetadata = async () => { title: seo.title, description: seo.description, }, - } + + alternates: { + canonical: url.webUrl, + types: { + 'application/rss+xml': [{ url: 'feed', title: 'RSS 订阅' }], + }, + }, + } satisfies Metadata } export default async function RootLayout(props: PropsWithChildren) {