|
1 | 1 | import type { Metadata } from "next"; |
| 2 | +import Link from "next/link"; |
| 3 | +import { cn } from "~/lib/utils"; |
2 | 4 | import { getPostList } from "~/utils/postData"; |
3 | 5 |
|
4 | | -const desc = [ |
5 | | - { |
6 | | - heading: "Platform", |
7 | | - content: [ |
8 | | - '<a class="text-link" target="_blank" rel="noopener noreferrer" href="https://github.com/json-q">Github</a>', |
9 | | - '<a class="text-link" target="_blank" rel="noopener noreferrer" href="https://gitee.com/jsonqi">Gitee</a>', |
10 | | - '<a class="text-link" target="_blank" rel="noopener noreferrer" href="https://www.cnblogs.com/jsonq">博客园</a>(有意义的内容会同步)', |
11 | | - ], |
12 | | - }, |
13 | | - { |
14 | | - heading: "Feature", |
15 | | - content: [ |
16 | | - "Nextjs + shadcn", |
17 | | - "markdown 编写,rehype remark 等相关插件优化展示", |
18 | | - "简单实现 markdown 编写保存时的页面 hmr", |
19 | | - "Github Action 自动化部署", |
20 | | - '<a class="text-link" target="_blank" rel="noopener noreferrer" href="https://jsonq.netlify.app">镜像站点</a> 托管 netlify', |
21 | | - "pagefind 本地检索(pagefind 仅支持 SSG)", |
22 | | - "优秀的性能和可访问性,Lighthouse 评分 95+(文章内容大小会影响 Performance)", |
23 | | - ], |
24 | | - }, |
25 | | -]; |
26 | | - |
27 | 6 | export const metadata: Metadata = { |
28 | 7 | title: "Home | Jsonq's Blog", |
29 | 8 | description: "基于 Nextjs 的博客, 简约, 专注于内容", |
30 | 9 | }; |
31 | 10 |
|
| 11 | +const titleCls = cn("my-4 font-semibold text-xl"); |
| 12 | +const ulCls = cn("ml-4 list-disc [&>li]:ml-4"); |
| 13 | + |
| 14 | +const platform = [ |
| 15 | + { title: "Github", url: "https://github.com/json-q" }, |
| 16 | + { title: "Gitee", url: "https://gitee.com/jsonqi" }, |
| 17 | + { title: "博客园", url: "https://www.cnblogs.com/jsonq" }, |
| 18 | +]; |
| 19 | + |
32 | 20 | export default async function Home() { |
33 | 21 | const postList = await getPostList(); |
34 | 22 |
|
35 | | - const mergedDesc = [ |
36 | | - { |
37 | | - heading: "Recently Updated", |
38 | | - content: postList |
39 | | - .slice(0, 5) |
40 | | - .map((item) => `<a class="underline hover:text-link transition-colors" href=${item.url}>${item.title}</a>`), |
41 | | - }, |
42 | | - ...desc, |
43 | | - ]; |
44 | | - |
45 | 23 | return ( |
46 | 24 | <div className="py-8"> |
47 | | - <h1 className="mb-4 text-center font-extrabold text-4xl tracking-tight will-change-auto lg:text-5xl"> |
48 | | - Jsonq's Blog |
49 | | - </h1> |
50 | | - {mergedDesc.map((item) => ( |
51 | | - <div key={item.heading} className="px-4 md:px-12"> |
52 | | - <h2 className="my-4 font-semibold text-3xl tracking-tight">{item.heading}</h2> |
53 | | - <ul className="list-disc [&>li]:ml-4"> |
54 | | - {item.content.map((content) => ( |
55 | | - <li className="py-1" key={content} dangerouslySetInnerHTML={{ __html: content }} /> |
56 | | - ))} |
57 | | - </ul> |
58 | | - </div> |
59 | | - ))} |
| 25 | + <h1 className="mb-4 text-center font-extrabold text-3xl will-change-auto lg:text-4xl">Jsonq's Blog</h1> |
| 26 | + <div className="px-4 md:px-12"> |
| 27 | + <h2 className={titleCls}>介绍</h2> |
| 28 | + <p className="indent-4"> |
| 29 | + 基于 Nextjs 的静态博客网站,托管于 |
| 30 | + <Link rel="noopener noreferrer" target="_blank" href="https://netlify.com" className="ml-2 text-link"> |
| 31 | + Netlify |
| 32 | + </Link> |
| 33 | + </p> |
| 34 | + |
| 35 | + <h2 className={titleCls}>最新文章</h2> |
| 36 | + <ul className={ulCls}> |
| 37 | + {postList.slice(0, 5).map((item) => ( |
| 38 | + <li className="py-1" key={item.slug}> |
| 39 | + <Link className="hover:underline" href={item.url}> |
| 40 | + {item.title} |
| 41 | + </Link> |
| 42 | + </li> |
| 43 | + ))} |
| 44 | + </ul> |
| 45 | + |
| 46 | + <h2 className={titleCls}>写作平台</h2> |
| 47 | + <ul className={ulCls}> |
| 48 | + {platform.map((item) => ( |
| 49 | + <li className="py-1" key={item.title}> |
| 50 | + <Link rel="noopener noreferrer" target="_blank" className="text-link" href={item.url}> |
| 51 | + {item.title} |
| 52 | + </Link> |
| 53 | + </li> |
| 54 | + ))} |
| 55 | + </ul> |
| 56 | + </div> |
60 | 57 | </div> |
61 | 58 | ); |
62 | 59 | } |
0 commit comments