Skip to content

Commit 1f7344f

Browse files
committed
refactor: standardize blog directory naming and update related paths in documentation and code
1 parent c22453e commit 1f7344f

File tree

11 files changed

+31
-31
lines changed

11 files changed

+31
-31
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Visit http://localhost:3000 to view your application.
8484
## 📝 Content Management
8585

8686
### Blog Posts
87-
Create MDX files in `blogs/[locale]` with the following format:
87+
Create MDX files in `blog/[locale]` with the following format:
8888

8989
```markdown
9090
---
@@ -132,14 +132,14 @@ nextjs-15-starter/
132132
├── app/ # App directory
133133
│ ├── [locale]/ # Internationalized routes
134134
│ │ ├── about/ # About page
135-
│ │ ├── blogs/ # Blog pages
135+
│ │ ├── blog/ # Blog pages
136136
│ │ └── ... # Other pages
137137
│ ├── api/ # API routes
138138
│ └── globals/ # Global components
139-
├── blogs/ # Blog content (MDX)
140-
│ ├── en/ # English blogs
141-
│ ├── ja/ # Japanese blogs
142-
│ └── zh/ # Chinese blogs
139+
├── blog/ # Blog content (MDX)
140+
│ ├── en/ # English blog
141+
│ ├── ja/ # Japanese blog
142+
│ └── zh/ # Chinese blog
143143
├── components/ # Reusable components
144144
│ ├── ui/ # Base UI components
145145
│ ├── header/ # Header components
@@ -213,7 +213,7 @@ pnpm type-check
213213
1. Adding new language support:
214214
- Add new language files in `i18n/messages/`
215215
- Update `i18n/routing.ts` configuration
216-
- Create corresponding language directories in `blogs/` and `content/`
216+
- Create corresponding language directories in `blog/` and `content/`
217217

218218
2. Using translations:
219219
```tsx

README_ja.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ http://localhost:3000 にアクセスして確認できます。
8484
## 📝 コンテンツ管理
8585

8686
### ブログ投稿
87-
`blogs/[locale]`にMDXファイルを以下のフォーマットで作成:
87+
`blog/[locale]`にMDXファイルを以下のフォーマットで作成:
8888

8989
```markdown
9090
---
@@ -132,11 +132,11 @@ nextjs-15-starter/
132132
├── app/ # アプリディレクトリ
133133
│ ├── [locale]/ # 多言語ルート
134134
│ │ ├── about/ # Aboutページ
135-
│ │ ├── blogs/ # ブログページ
135+
│ │ ├── blog/ # ブログページ
136136
│ │ └── ... # その他のページ
137137
│ ├── api/ # APIルート
138138
│ └── globals/ # グローバルコンポーネント
139-
├── blogs/ # ブログコンテンツ(MDX)
139+
├── blog/ # ブログコンテンツ(MDX)
140140
│ ├── en/ # 英語ブログ
141141
│ ├── ja/ # 日本語ブログ
142142
│ └── zh/ # 中国語ブログ
@@ -213,7 +213,7 @@ pnpm type-check
213213
1. 新しい言語サポートの追加:
214214
- `i18n/messages/` に新しい言語ファイルを追加
215215
- `i18n/routing.ts` 設定を更新
216-
- `blogs/``content/` に対応する言語ディレクトリを作成
216+
- `blog/``content/` に対応する言語ディレクトリを作成
217217

218218
2. 翻訳の使用:
219219
```tsx

README_zh.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ pnpm dev
8484
## 📝 内容管理
8585

8686
### 博客文章
87-
`blogs/[locale]` 目录下创建 MDX 文件,支持以下格式:
87+
`blog/[locale]` 目录下创建 MDX 文件,支持以下格式:
8888

8989
```markdown
9090
---
@@ -132,11 +132,11 @@ nextjs-15-starter/
132132
├── app/ # 应用路由目录
133133
│ ├── [locale]/ # 多语言路由
134134
│ │ ├── about/ # 关于页面
135-
│ │ ├── blogs/ # 博客页面
135+
│ │ ├── blog/ # 博客页面
136136
│ │ └── ... # 其他页面
137137
│ ├── api/ # API 路由
138138
│ └── globals/ # 全局组件
139-
├── blogs/ # 博客内容 (MDX)
139+
├── blog/ # 博客内容 (MDX)
140140
│ ├── en/ # 英文博客
141141
│ ├── ja/ # 日文博客
142142
│ └── zh/ # 中文博客
@@ -214,7 +214,7 @@ pnpm type-check
214214
1. 新增语言支持:
215215
-`i18n/messages/` 添加新的语言文件
216216
- 更新 `i18n/routing.ts` 配置
217-
-`blogs/``content/` 下创建对应语言目录
217+
-`blog/``content/` 下创建对应语言目录
218218

219219
2. 使用翻译:
220220
```tsx

app/[locale]/blogs/BlogCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Image from "next/image";
66
export function BlogCard({ post, locale }: { post: BlogPost; locale: string }) {
77
return (
88
<I18nLink
9-
href={`/blogs${post.slug}`}
9+
href={`/blog${post.slug}`}
1010
prefetch={false}
1111
className="bg-transparent rounded-lg hover:underline"
1212
>

app/[locale]/blogs/[slug]/page.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ export async function generateMetadata({
3030
description: "Page not found",
3131
noIndex: true,
3232
locale: locale as Locale,
33-
path: `/blogs/${slug}`,
34-
canonicalUrl: `/blogs/${slug}`,
33+
path: `/blog/${slug}`,
34+
canonicalUrl: `/blog/${slug}`,
3535
});
3636
}
3737

3838
return constructMetadata({
39-
page: "blogs",
39+
page: "blog",
4040
title: post.title,
4141
description: post.description,
4242
images: post.image ? [post.image] : [],
4343
locale: locale as Locale,
44-
path: `/blogs/${slug}`,
45-
canonicalUrl: `/blogs/${slug}`,
44+
path: `/blog/${slug}`,
45+
canonicalUrl: `/blog/${slug}`,
4646
});
4747
}
4848

@@ -92,7 +92,7 @@ export async function generateStaticParams() {
9292

9393
return LOCALES.flatMap((locale) =>
9494
posts.map((post) => {
95-
const slugPart = post.slug.replace(/^\//, "").replace(/^blogs\//, "");
95+
const slugPart = post.slug.replace(/^\//, "").replace(/^blog\//, "");
9696

9797
return {
9898
locale,

app/[locale]/blogs/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BlogCard } from "@/app/[locale]/blogs/BlogCard";
1+
import { BlogCard } from "@/app/[locale]/blog/BlogCard";
22
import { Locale } from "@/i18n/routing";
33
import { getPosts } from "@/lib/getBlogs";
44
import { constructMetadata } from "@/lib/metadata";
@@ -22,8 +22,8 @@ export async function generateMetadata({
2222
title: t("title"),
2323
description: t("description"),
2424
locale: locale as Locale,
25-
path: `/blogs`,
26-
canonicalUrl: `/blogs`,
25+
path: `/blog`,
26+
canonicalUrl: `/blog`,
2727
});
2828
}
2929

app/sitemap.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
1111
// Static pages
1212
const staticPages = [
1313
'',
14-
'/blogs',
14+
'/blog',
1515
'/about',
1616
'/privacy-policy',
1717
'/terms-of-service',
@@ -31,7 +31,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
3131
LOCALES.map(async (locale) => {
3232
const { posts } = await getPosts(locale)
3333
return posts.map(post => ({
34-
url: `${siteUrl}${locale === DEFAULT_LOCALE ? '' : `/${locale}`}/blogs${post.slug}`,
34+
url: `${siteUrl}${locale === DEFAULT_LOCALE ? '' : `/${locale}`}/blog${post.slug}`,
3535
lastModified: post.metadata.updatedAt || post.date,
3636
changeFrequency: 'daily' as const,
3737
priority: 0.7,

content/about/en.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Visit [http://localhost:3000](http://localhost:3000) to view your application.
6060
## 📝 Content Management
6161

6262
### Blog Posts
63-
Create MDX files in `blogs/[locale]` with the following format:
63+
Create MDX files in `blog/[locale]` with the following format:
6464
````
6565
6666
---

content/about/ja.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Next Forge は、グローバル対応のウェブサイトを素早く構築す
6060
## 📝 コンテンツ管理
6161

6262
### ブログ投稿
63-
`blogs/[locale]` ディレクトリに以下のフォーマットで MDX ファイルを作成します:
63+
`blog/[locale]` ディレクトリに以下のフォーマットで MDX ファイルを作成します:
6464
````
6565
6666
---

content/about/zh.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Next Forge 是一个功能完备的 Next.js 15 多语言启动模板,旨在帮
6060
## 📝 内容管理
6161

6262
### 博客文章
63-
`blogs/[locale]` 目录下创建 MDX 文件,支持以下格式:
63+
`blog/[locale]` 目录下创建 MDX 文件,支持以下格式:
6464
```markdown
6565
---
6666
title: 文章标题

0 commit comments

Comments
 (0)