fix: blog post image can not load

- Update base URL environment variable from NEXT_PUBLIC_BASE_URL to NEXT_PUBLIC_APP_URL
This commit is contained in:
javayhu 2025-03-07 01:04:56 +08:00
parent 48adc7ad4a
commit 4657e5b691
2 changed files with 3 additions and 4 deletions

View File

@ -1,6 +1,7 @@
import AllPostsButton from '@/components/blog/all-posts-button';
import { BlogToc } from '@/components/blog/blog-toc';
import { Mdx } from '@/components/marketing/blog/mdx-component';
import { Link } from '@/i18n/navigation';
import { getTableOfContents } from '@/lib/toc';
import { getBaseUrl } from '@/lib/urls/get-base-url';
import { getLocaleDate } from '@/lib/utils';
@ -8,9 +9,7 @@ import type { NextPageProps } from '@/types/next-page-props';
import { allPosts } from 'content-collections';
import type { Metadata } from 'next';
import Image from 'next/image';
import { Link } from '@/i18n/navigation';
import { notFound } from 'next/navigation';
import { useTranslations } from 'next-intl';
import '@/styles/mdx.css';
import { getTranslations } from 'next-intl/server';
@ -141,7 +140,7 @@ export default async function BlogPostPage(props: NextPageProps) {
<div className="relative h-12 w-12 flex-shrink-0">
{post.author?.avatar && (
<Image
src={post?.author?.avatar}
src={post.author.avatar}
alt={`avatar for ${post.author.name}`}
className="rounded-full object-cover border"
fill

View File

@ -1,7 +1,7 @@
// import { DEFAULT_LOCALE } from '@/lib/i18n/locale';
const baseUrl =
process.env.NEXT_PUBLIC_BASE_URL ??
process.env.NEXT_PUBLIC_APP_URL ??
`http://localhost:${process.env.PORT ?? 3000}`;
export function getBaseUrl(): string {