Skip to content

Commit 5171cdf

Browse files
Update article.tsx
1 parent b45cbde commit 5171cdf

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/app/article/article.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function getArticleIndexes() {
2828
return true;
2929
});
3030

31-
const articles = years.flatMap((year) => {
31+
const articles = years.reverse().flatMap((year) => {
3232
const yearPath = path.join(postsDirectory, year);
3333
const months = fs.readdirSync(yearPath).filter((month) => {
3434
const monthPath = path.join(yearPath, month);
@@ -37,15 +37,15 @@ export function getArticleIndexes() {
3737
return false;
3838
});
3939

40-
return months.flatMap((month) => {
40+
return months.reverse().flatMap((month) => {
4141
const monthPath = path.join(yearPath, month);
4242
const articleIds = fs.readdirSync(monthPath).filter((articleId) => {
4343
const articlePath = path.join(monthPath, articleId);
4444
if (!fs.statSync(articlePath).isDirectory()) return false; // ファイルの場合はスキップ
4545
return true;
4646
});
4747

48-
return articleIds
48+
return articleIds.reverse()
4949
.map((articleId) => {
5050
const articleDir = path.join(monthPath, articleId);
5151
const articleFiles = fs
@@ -86,7 +86,6 @@ export function getArticleIndexes() {
8686
.flat(); // ネストされた配列を平坦化
8787
});
8888
});
89-
articles.reverse();
9089
return articles;
9190
}
9291
function findThumbnailFile(directory: string): string | null {

0 commit comments

Comments
 (0)