Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/api/portfolio/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const shipfriend: PortfolioItem = {
category: '개인 블로그',
links: {
githubUrl: 'https://github.com/shipfriend0516/techblog',
deployUrl: 'https://shipfriend.vercel.app',
deployUrl: 'https://www.shipfriend.dev',
},
};
const preview: PortfolioItem = {
Expand Down
11 changes: 9 additions & 2 deletions app/api/redirect/recent/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ export const dynamic = 'force-dynamic'; // 캐싱 방지
export async function GET() {
try {
await dbConnect();
const pageUrl = process.env.NEXTAUTH_URL;
const pageUrl =
process.env.NEXT_PUBLIC_DEPLOYMENT_URL ||
process.env.NEXTAUTH_URL ||
'https://shipfriend.dev';

// 최신 글 1개 가져오기
const latestPost = await Post.findOne({}).sort({ date: -1 }).select('slug');
Expand All @@ -23,6 +26,10 @@ export async function GET() {
);
} catch (error) {
console.error('Error redirecting to latest post:', error);
return NextResponse.redirect(new URL(`${process.env.NEXTAUTH_URL}/posts`));
const pageUrl =
process.env.NEXT_PUBLIC_DEPLOYMENT_URL ||
process.env.NEXTAUTH_URL ||
'https://shipfriend.dev';
return NextResponse.redirect(new URL(`${pageUrl}/posts`));
}
}
2 changes: 1 addition & 1 deletion app/entities/post/api/postAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Post } from '@/app/types/Post';
interface GetPostDetailResponse {
post: Post;
}
const URL = process.env.NEXT_PUBLIC_URL || 'http://localhost:3000';
const URL = process.env.NEXT_PUBLIC_DEPLOYMENT_URL || process.env.NEXT_PUBLIC_URL || 'http://localhost:3000';

export const getPostDetail = async (
slug: string
Expand Down
7 changes: 6 additions & 1 deletion app/entities/post/detail/PostJSONLd.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { Post } from '@/app/types/Post';

const PostJSONLd = ({ post }: { post: Post }) => {
const baseUrl =
process.env.NEXT_PUBLIC_DEPLOYMENT_URL ||
process.env.NEXT_PUBLIC_URL ||
'https://shipfriend.dev';

return (
<script
type="application/ld+json"
Expand Down Expand Up @@ -28,7 +33,7 @@ const PostJSONLd = ({ post }: { post: Post }) => {
name: 'ShipFriend TechBlog',
logo: {
'@type': 'ImageObject',
url: `https://oraciondev.vercel.app/favicon.ico`,
url: `${baseUrl}/favicon.ico`,
},
},
}),
Expand Down
3 changes: 1 addition & 2 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export const metadata: Metadata = {
openGraph: {
title: 'ShipFriend TechBlog',
description: '문제 해결 경험과 개발 지식을 공유하는 개발 블로그입니다.',
url:
process.env.NEXT_PUBLIC_DEPLOYMENT_URL || 'https://shipfriend.vercel.app',
url: process.env.NEXT_PUBLIC_DEPLOYMENT_URL || 'https://www.shipfriend.dev',
siteName: 'ShipFriend TechBlog',
images: [
{
Expand Down
7 changes: 5 additions & 2 deletions app/lib/email/resend.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Resend } from 'resend';
import {
getVerificationEmailHTML,
getNewPostEmailHTML,
getUnsubscribeEmailHTML,
getVerificationEmailHTML,
} from './templates';

if (!process.env.RESEND_API_KEY) {
Expand All @@ -12,7 +12,10 @@ if (!process.env.RESEND_API_KEY) {
const resend = new Resend(process.env.RESEND_API_KEY);

const FROM_EMAIL = process.env.EMAIL_FROM || '';
const BASE_URL = process.env.NEXT_PUBLIC_URL || 'http://localhost:3000';
const BASE_URL =
process.env.NEXT_PUBLIC_DEPLOYMENT_URL ||
process.env.NEXT_PUBLIC_URL ||
'https://shipfriend.dev';

export async function sendVerificationEmail(
email: string,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/rss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'path';
import { Feed } from 'feed';

export async function generateRssFeed(posts: any[]) {
const site_url = process.env.NEXTAUTH_URL || 'http://localhost:3000';
const site_url = process.env.NEXT_PUBLIC_DEPLOYMENT_URL || process.env.NEXTAUTH_URL || 'http://localhost:3000';

const feedOptions = {
title: 'ShipFriend TechBlog',
Expand Down
2 changes: 1 addition & 1 deletion app/portfolio/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const projects: Project[] = [
description: '개인 개발 블로그',
image: '/images/logo/shipfriend-logo.webp',
tags: ['Next.js', 'TypeScript', 'MongoDB'],
demoUrl: 'https://shipfriend.vercel.app/',
demoUrl: 'https://shipfriend.dev/',
githubUrl: 'https://github.com/ShipFriend0516/TechBlog',
slug: 'shipfriend',
},
Expand Down
5 changes: 5 additions & 0 deletions app/posts/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,17 @@ export const generateMetadata = async ({
params: { slug: string };
}): Promise<Metadata> => {
const { post } = await getPostDetail(params.slug);
const baseUrl =
process.env.NEXT_PUBLIC_DEPLOYMENT_URL || 'https://shipfriend.dev';
const postUrl = `${baseUrl}/posts/${post.slug}`;

return {
title: post.title,
description: post.subTitle || post.content.substring(0, 160),
openGraph: {
title: post.title,
description: post.subTitle || post.content.substring(0, 160),
url: postUrl,
images: [post.thumbnailImage || defaultThumbnail],
type: 'article',
publishedTime: new Date(post.createdAt).toISOString(),
Expand Down
2 changes: 1 addition & 1 deletion app/robots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { MetadataRoute } from 'next';

export default function robots(): MetadataRoute.Robots {
const baseURL = process.env.NEXTAUTH_URL || 'http://localhost:3000';
const baseURL = process.env.NEXT_PUBLIC_DEPLOYMENT_URL || process.env.NEXTAUTH_URL || 'http://localhost:3000';
return {
rules: {
userAgent: '*',
Expand Down
2 changes: 1 addition & 1 deletion app/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import dbConnect from '@/app/lib/dbConnect';
import Post from '@/app/models/Post';

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const baseUrl = process.env.NEXTAUTH_URL || 'http://localhost:3000';
const baseUrl = process.env.NEXT_PUBLIC_DEPLOYMENT_URL || process.env.NEXTAUTH_URL || 'http://localhost:3000';
const staticPages = [
{
url: baseUrl,
Expand Down