From 68ccd85092f2031f85d2e318110e76f691dc57f8 Mon Sep 17 00:00:00 2001 From: kWAY <55437151+kWAYTV@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:35:52 +0100 Subject: [PATCH] refactor: Update baseUrl imports and layout metadata - Replaced imports of baseUrl from '@/lib/metadata' to '@/app/sitemap' across multiple files for consistency. - Adjusted the layout metadata to ensure the default title and template are correctly formatted. - Enhanced the structure of the metadataBase by converting baseUrl to a URL object. --- src/app/(routes)/rss/route.ts | 2 +- src/app/(site)/blog/[slug]/page.tsx | 2 +- src/app/layout.tsx | 8 ++++---- src/app/robots.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app/(routes)/rss/route.ts b/src/app/(routes)/rss/route.ts index a4c6e63..8c949ec 100644 --- a/src/app/(routes)/rss/route.ts +++ b/src/app/(routes)/rss/route.ts @@ -1,5 +1,5 @@ +import { baseUrl } from '@/app/sitemap'; import { getBlogPosts } from '@/lib/blog'; -import { baseUrl } from '@/lib/metadata'; export async function GET() { const allBlogs = await getBlogPosts(); diff --git a/src/app/(site)/blog/[slug]/page.tsx b/src/app/(site)/blog/[slug]/page.tsx index 918284a..2dccb9c 100644 --- a/src/app/(site)/blog/[slug]/page.tsx +++ b/src/app/(site)/blog/[slug]/page.tsx @@ -1,8 +1,8 @@ import { notFound } from 'next/navigation'; +import { baseUrl } from '@/app/sitemap'; import { CustomMDX } from '@/components/core/blog/mdx'; import { formatDate, getBlogPosts } from '@/lib/blog'; -import { baseUrl } from '@/lib/metadata'; export async function generateStaticParams() { const posts = getBlogPosts(); diff --git a/src/app/layout.tsx b/src/app/layout.tsx index b85efe5..8ab3348 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -3,11 +3,11 @@ import './globals.css'; import localFont from 'next/font/local'; import { ViewTransitions } from 'next-view-transitions'; +import { baseUrl } from '@/app/sitemap'; import Footer from '@/components/layout/footer'; import { Navbar } from '@/components/layout/nav'; import { Providers } from '@/components/providers'; import { createMetadata } from '@/lib/metadata'; -import { baseUrl } from '@/lib/metadata'; const geistSans = localFont({ src: './fonts/GeistVF.woff', @@ -46,9 +46,9 @@ export default function RootLayout({ export const metadata = createMetadata({ title: { - template: '%s | perc.dev', - default: 'perc.dev' + default: 'perc.dev', + template: '%s | perc.dev' }, description: 'Welcome to my portfolio!', - metadataBase: baseUrl + metadataBase: new URL(baseUrl) }); diff --git a/src/app/robots.ts b/src/app/robots.ts index 90a2d43..9f37531 100644 --- a/src/app/robots.ts +++ b/src/app/robots.ts @@ -1,4 +1,4 @@ -import { baseUrl } from '@/lib/metadata'; +import { baseUrl } from '@/app/sitemap'; export default function robots() { return {