From f32206d390c34bd0ee1c38e3ce15987ea5801ccb Mon Sep 17 00:00:00 2001 From: gbanyan Date: Wed, 19 Nov 2025 02:07:35 +0800 Subject: [PATCH] Use next/image for hero/sidebar/markdown images --- app/blog/[slug]/page.tsx | 19 ++++++++++--------- app/pages/[slug]/page.tsx | 19 ++++++++++--------- components/right-sidebar.tsx | 7 +++++-- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/app/blog/[slug]/page.tsx b/app/blog/[slug]/page.tsx index d6a9dcf..6f1a76f 100644 --- a/app/blog/[slug]/page.tsx +++ b/app/blog/[slug]/page.tsx @@ -1,4 +1,5 @@ import Link from 'next/link'; +import Image from 'next/image'; import { notFound } from 'next/navigation'; import type { Metadata } from 'next'; import { allPosts } from 'contentlayer/generated'; @@ -85,15 +86,15 @@ export default function BlogPostPage({ params }: Props) {
- {post.feature_image && ( - // feature_image is stored as "../assets/xyz", serve from "/assets/xyz" - // eslint-disable-next-line @next/next/no-img-element - {post.title} - )} + {post.feature_image && ( + {post.title} + )}
diff --git a/app/pages/[slug]/page.tsx b/app/pages/[slug]/page.tsx index e2b63ab..af1a031 100644 --- a/app/pages/[slug]/page.tsx +++ b/app/pages/[slug]/page.tsx @@ -1,4 +1,5 @@ import Link from 'next/link'; +import Image from 'next/image'; import { notFound } from 'next/navigation'; import type { Metadata } from 'next'; import { allPages } from 'contentlayer/generated'; @@ -70,15 +71,15 @@ export default function StaticPage({ params }: Props) { )}
- {page.feature_image && ( - // feature_image is stored as "../assets/xyz", serve from "/assets/xyz" - // eslint-disable-next-line @next/next/no-img-element - {page.title} - )} + {page.feature_image && ( + {page.title} + )}
diff --git a/components/right-sidebar.tsx b/components/right-sidebar.tsx index abcf2d0..1791709 100644 --- a/components/right-sidebar.tsx +++ b/components/right-sidebar.tsx @@ -1,4 +1,5 @@ import Link from 'next/link'; +import Image from 'next/image'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faGithub, faMastodon, faLinkedin } from '@fortawesome/free-brands-svg-icons'; import { faFire, faArrowRight } from '@fortawesome/free-solid-svg-icons'; @@ -50,10 +51,12 @@ export function RightSidebar() { className="mb-2 inline-block transition-transform duration-300 ease-out group-hover:-translate-y-0.5" > {avatarSrc ? ( - // eslint-disable-next-line @next/next/no-img-element - {siteConfig.name} ) : (