From b1ca8d3306b35259849a2bf4ebe8077fb579e0a3 Mon Sep 17 00:00:00 2001 From: lloydrichards Date: Wed, 15 May 2024 07:47:53 +0200 Subject: [PATCH] fix(routing): :bug: remove baseUrl --- src/app/(posts)/blogs/[slug]/page.tsx | 5 ++--- src/app/(posts)/labs/[slug]/page.tsx | 5 ++--- src/app/layout.tsx | 18 +++++++++--------- src/lab_modules/033.tsx | 4 ++-- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/app/(posts)/blogs/[slug]/page.tsx b/src/app/(posts)/blogs/[slug]/page.tsx index 85682f1..ed2634f 100644 --- a/src/app/(posts)/blogs/[slug]/page.tsx +++ b/src/app/(posts)/blogs/[slug]/page.tsx @@ -3,7 +3,6 @@ import { Metadata } from "next"; import "@/styles/mdx.css"; import { getBlog } from "@/service/get-blog"; import { getAllBlogs } from "@/service/get-all-blog"; -import { getBaseUrl } from "@/lib/utils"; export interface BlogPageProps { params: { @@ -15,7 +14,7 @@ export async function generateMetadata({ params, }: BlogPageProps): Promise { const { title, description, slug } = await getBlog(params.slug); - const ogImage = `${getBaseUrl()}/api/og?title=${encodeURIComponent(title)}`; + const ogImage = `/api/og?title=${encodeURIComponent(title)}`; return { title, @@ -24,7 +23,7 @@ export async function generateMetadata({ title, description, type: "article", - url: `${getBaseUrl()}${slug}`, + url: slug, images: [ { url: ogImage, diff --git a/src/app/(posts)/labs/[slug]/page.tsx b/src/app/(posts)/labs/[slug]/page.tsx index 1145118..a6ce904 100644 --- a/src/app/(posts)/labs/[slug]/page.tsx +++ b/src/app/(posts)/labs/[slug]/page.tsx @@ -16,7 +16,6 @@ import { Metadata } from "next"; import { FC } from "react"; import { getLab } from "@/service/get-lab"; import { getAllLabs } from "@/service/get-all-lab"; -import { getBaseUrl } from "@/lib/utils"; export interface LabPageProps { params: { @@ -28,7 +27,7 @@ export async function generateMetadata({ params, }: LabPageProps): Promise { const { title, description, slug } = await getLab(params.slug); - const ogImage = `${getBaseUrl()}/api/og?title=${encodeURIComponent(title)}`; + const ogImage = `/api/og?title=${encodeURIComponent(title)}`; return { title, @@ -37,7 +36,7 @@ export async function generateMetadata({ title, description, type: "article", - url: `${getBaseUrl()}${slug}`, + url: slug, images: [ { url: ogImage, diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 396e81d..6e6dc97 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -5,30 +5,30 @@ import { Layout } from "@/components/template/layout/layout"; import { ThemeProvider } from "next-themes"; import "../styles/globals.css"; -import { getBaseUrl } from "@/lib/utils"; export const metadata = { title: "Lloyd Richards Design", description: "Digital playground of Lloyd Richards, a designer and developer.", icons: { - icon: "/favicon.svg", + icon: `/favicon.svg`, }, openGraph: { - locale: "en_US", - url: getBaseUrl(), title: "Lloyd Richards Design", description: "Digital playground of Lloyd Richards, a designer and developer.", images: [ { - url: `${getBaseUrl()}/images/lloyd_richards_portrait.png`, - width: 400, - height: 600, - alt: "Lloyd Richards Portrait", + url: `/images/lloyd_richards_portrait.png`, }, ], - siteName: "Lloyd Richards Design", + }, + twitter: { + card: "summary_large_image", + title: "Lloyd Richards Design", + description: + "Digital playground of Lloyd Richards, a designer and developer.", + images: [`/images/lloyd_richards_portrait.png`], }, }; diff --git a/src/lab_modules/033.tsx b/src/lab_modules/033.tsx index 0ac499f..da85879 100644 --- a/src/lab_modules/033.tsx +++ b/src/lab_modules/033.tsx @@ -87,7 +87,7 @@ const handleErrors = (appError: AppError): T.Task => { } }; -const getFromUrl = (url: string) => +const _getFromUrl = (url: string) => pipe( TE.tryCatch( () => fetch(url), @@ -105,7 +105,7 @@ const getFromUrl = (url: string) => TE.fold(handleErrors, (data) => T.of(data.value.name)), ); -getFromUrl("https://api.chucknorris.io/jokes/random")().then(console.log); // Output: "Invalid value undefined supplied to : { status: string, value: { id: number, name: string } }/status: string" +// getFromUrl("https://api.chucknorris.io/jokes/random")().then(console.log); // Output: "Invalid value undefined supplied to : { status: string, value: { id: number, name: string } }/status: string" /* * Branching Render Logic