From a249a120a57fdf8512373c9dd9afbad6b6e8b2a4 Mon Sep 17 00:00:00 2001 From: Gbanyan Date: Wed, 19 Nov 2025 17:38:45 +0800 Subject: [PATCH] Stage all layout updates --- app/blog/[slug]/page.tsx | 45 +++++++-------- app/blog/page.tsx | 21 ++++--- app/layout.tsx | 9 ++- app/page.tsx | 53 +++++++++--------- app/pages/[slug]/page.tsx | 102 +++++++++++++++++++--------------- app/tags/[tag]/page.tsx | 30 ++++++++-- app/tags/page.tsx | 91 +++++++++++++++--------------- app/template.tsx | 15 +++++ components/layout-shell.tsx | 7 +-- components/post-layout.tsx | 75 +++++++++++++++++++++++++ components/post-list-item.tsx | 2 +- components/sidebar-layout.tsx | 10 ++++ package-lock.json | 61 +++++++++++++++++++- styles/globals.css | 87 ++++++++++++++++++----------- tailwind.config.js | 10 +++- 15 files changed, 424 insertions(+), 194 deletions(-) create mode 100644 app/template.tsx create mode 100644 components/post-layout.tsx create mode 100644 components/sidebar-layout.tsx diff --git a/app/blog/[slug]/page.tsx b/app/blog/[slug]/page.tsx index 6f1a76f..c7821ee 100644 --- a/app/blog/[slug]/page.tsx +++ b/app/blog/[slug]/page.tsx @@ -6,8 +6,8 @@ import { allPosts } from 'contentlayer/generated'; import { getPostBySlug, getRelatedPosts, getPostNeighbors } from '@/lib/posts'; import { siteConfig } from '@/lib/config'; import { ReadingProgress } from '@/components/reading-progress'; -import { PostToc } from '@/components/post-toc'; import { ScrollReveal } from '@/components/scroll-reveal'; +import { PostLayout } from '@/components/post-layout'; import { PostCard } from '@/components/post-card'; import { PostStorylineNav } from '@/components/post-storyline-nav'; import { SectionDivider } from '@/components/section-divider'; @@ -43,17 +43,16 @@ export default function BlogPostPage({ params }: Props) { const relatedPosts = getRelatedPosts(post, 3); const neighbors = getPostNeighbors(post); + const hasToc = / -
- -
+ +
-
+
{post.published_at && (

{new Date(post.published_at).toLocaleDateString( @@ -65,14 +64,14 @@ export default function BlogPostPage({ params }: Props) { {post.title} {post.tags && ( -

+
{post.tags.map((t) => ( #{t} @@ -85,16 +84,18 @@ export default function BlogPostPage({ params }: Props) { -
- {post.feature_image && ( - {post.title} - )} +
+ {post.feature_image && ( +
+ {post.title} +
+ )}
@@ -115,7 +116,7 @@ export default function BlogPostPage({ params }: Props) { {relatedPosts.length > 0 && ( -
+

相關文章 @@ -124,7 +125,7 @@ export default function BlogPostPage({ params }: Props) { 為你挑選相似主題

-
+
{relatedPosts.map((related) => ( ))} @@ -134,7 +135,7 @@ export default function BlogPostPage({ params }: Props) { )}
-
+ ); } diff --git a/app/blog/page.tsx b/app/blog/page.tsx index 2eca05e..ada4740 100644 --- a/app/blog/page.tsx +++ b/app/blog/page.tsx @@ -1,6 +1,7 @@ import { getAllPostsSorted } from '@/lib/posts'; import { PostListWithControls } from '@/components/post-list-with-controls'; import { TimelineWrapper } from '@/components/timeline-wrapper'; +import { SidebarLayout } from '@/components/sidebar-layout'; export const metadata = { title: '所有文章' @@ -11,15 +12,17 @@ export default function BlogIndexPage() { return (
-
-

- 所有文章 -

-

- 繼續往下滑,慢慢逛逛。 -

-
- + +
+

+ 所有文章 +

+

+ 繼續往下滑,慢慢逛逛。 +

+
+ +
); } diff --git a/app/layout.tsx b/app/layout.tsx index 2f24dc4..2918654 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -3,6 +3,13 @@ import type { Metadata } from 'next'; import { siteConfig } from '@/lib/config'; import { LayoutShell } from '@/components/layout-shell'; import { ThemeProvider } from 'next-themes'; +import { Playfair_Display } from 'next/font/google'; + +const playfair = Playfair_Display({ + subsets: ['latin'], + variable: '--font-serif-eng', + display: 'swap', +}); export const metadata: Metadata = { title: { @@ -38,7 +45,7 @@ export default function RootLayout({ const theme = siteConfig.theme; return ( - +