Files
blog-nextjs/app/blog/page.tsx
gbanyan 1b495d2d2d Remove next-view-transitions and use native View Transition API
- Remove external next-view-transitions dependency
- Use Next.js 16 native navigation and Safari 18+ native View Transition API
- Add ViewTransitionProvider for minimal wrapping with Safari 18+ detection
- Updated all Link imports from external package to next/link
- Removed link-wrapper.tsx and view-transitions-wrapper.tsx

This resolves Safari compatibility issues while maintaining transitions on modern browsers.
2026-03-14 23:00:21 +08:00

65 lines
2.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import Link from 'next/link';
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';
import { SectionDivider } from '@/components/section-divider';
import { ScrollReveal } from '@/components/scroll-reveal';
import { FiTrendingUp } from 'react-icons/fi';
import { siteConfig } from '@/lib/config';
import { JsonLd } from '@/components/json-ld';
export const metadata = {
title: '所有文章',
description: '瀏覽所有文章,持續更新中。',
alternates: {
canonical: `${siteConfig.url}/blog`
}
};
export default function BlogIndexPage() {
const posts = getAllPostsSorted();
// Blog schema
const blogSchema = {
'@context': 'https://schema.org',
'@type': 'Blog',
name: '所有文章',
description: '瀏覽所有文章,持續更新中。',
url: `${siteConfig.url}/blog`,
inLanguage: siteConfig.defaultLocale,
blogPost: posts.slice(0, 10).map((post) => ({
'@type': 'BlogPosting',
headline: post.title,
url: `${siteConfig.url}${post.url}`,
datePublished: post.published_at,
dateModified: post.updated_at || post.published_at,
author: {
'@type': 'Person',
name: siteConfig.author
}
}))
};
return (
<section className="space-y-4">
<JsonLd data={blogSchema} />
<SidebarLayout>
<SectionDivider>
<ScrollReveal>
<header className="space-y-1">
<h1 className="type-title font-semibold text-slate-900 dark:text-slate-50">
</h1>
<p className="type-small text-slate-500 dark:text-slate-400">
</p>
</header>
</ScrollReveal>
</SectionDivider>
<PostListWithControls posts={posts} />
</SidebarLayout>
</section>
);
}