diff --git a/24.03/demo.gif b/24.03/demo.gif deleted file mode 100644 index 8fd1c3b9..00000000 Binary files a/24.03/demo.gif and /dev/null differ diff --git a/24.03/enjoy_tui.md b/24.03/enjoy_tui.md index 84bf58b6..9b5775e6 100644 --- a/24.03/enjoy_tui.md +++ b/24.03/enjoy_tui.md @@ -3,7 +3,7 @@ `tui`就是文字组成的ui,用字符串在控制台布局ui的形式,相比于图形化页面来说,功能比较原始,但是对于服务器系统来说,还是很有用的。比如我们在linux上常用的一些指令就有布局`tui`,像ps、top等,也有后来做的比较炫酷的像btm如下。 -![gif](demo.gif) +![gif](https://i.imgur.com/h1IDUMd.png) `tui`的实现方式有很多,最简单的就是使用console相关的sdk,指定控制台的大小,然后在控制台上输出字符串,这种方式可以实现一些简单的功能,但是对于复杂的布局,还是不太方便。所以需要一些库的封装。 diff --git a/app/blog/[month]/[slug]/page.js b/app/blog/[month]/[slug]/page.js index 5f0195e4..1aa54482 100644 --- a/app/blog/[month]/[slug]/page.js +++ b/app/blog/[month]/[slug]/page.js @@ -1,5 +1,6 @@ import fs from 'fs'; import path from 'path'; +import { notFound } from 'next/dist/client/components/not-found'; import remarkGfm from 'remark-gfm'; import rehypeSlug from 'rehype-slug'; import rehypePrismPlus from 'rehype-prism-plus'; @@ -17,7 +18,6 @@ import Discussion from '@/app/components/Discussion'; import { Button, Card, Tooltip, DirectoryTree } from '@/app/components/Antd'; import { Tabs, Item } from '@/app/components/Tabs'; - export default async function Post({ params }) { let { month, slug } = params; slug = querystring.unescape(slug); @@ -32,7 +32,7 @@ export default async function Post({ params }) { try { mdxSource = fs.existsSync(mdxPath) ? fs.readFileSync(mdxPath, 'utf8') : fs.readFileSync(mdPath, 'utf8'); } catch (e) { - return <>
404 PAGE NOT FOUND
; + notFound(); } const { text: readingTimeText } = readingTime(mdxSource); const result = await bundleMDX({ @@ -117,4 +117,14 @@ export async function generateStaticParams() { }); return posts; }) + + return postsList; } + +export async function generateMetadata({params}) { + let { month, slug } = params; + slug = querystring.unescape(slug); + return { + title: `${month} | ${slug}` + } +} \ No newline at end of file diff --git a/app/components/NavbarMenu.jsx b/app/components/NavbarMenu.jsx index f98d4237..12616766 100644 --- a/app/components/NavbarMenu.jsx +++ b/app/components/NavbarMenu.jsx @@ -119,14 +119,14 @@ export default function Navbar({ className }) { className={cn("fixed inset-x-0 max-w-[25rem] mx-auto z-50", className)} > - + notebook 首页 - - + + github github - + diff --git a/app/error.jsx b/app/error.jsx new file mode 100644 index 00000000..78b62561 --- /dev/null +++ b/app/error.jsx @@ -0,0 +1,8 @@ +'use client' +export default function Error() { + return <> +
+ Server Error +
+ ; +} \ No newline at end of file diff --git a/app/globals.css b/app/globals.css index 43e5b806..6d10c86e 100644 --- a/app/globals.css +++ b/app/globals.css @@ -190,7 +190,7 @@ nav>ol.toc-level-1 { margin-right: 5px; } .markdown-body main img { - width: calc(100% - 20px); + max-width: calc(100% - 20px); padding: 5px; border-radius: 5px; border: 1px solid; diff --git a/app/loading.jsx b/app/loading.jsx new file mode 100644 index 00000000..3cccbf77 --- /dev/null +++ b/app/loading.jsx @@ -0,0 +1,3 @@ +export default function Loading() { + return

Loading...

+} \ No newline at end of file diff --git a/app/not-found.jsx b/app/not-found.jsx new file mode 100644 index 00000000..4b42f327 --- /dev/null +++ b/app/not-found.jsx @@ -0,0 +1,7 @@ +export default function NotFound() { + return <> +
+ 404 PAGE NOT FOUND +
+ ; +} \ No newline at end of file diff --git a/app/page.js b/app/page.js index e1b06006..f55f06b5 100644 --- a/app/page.js +++ b/app/page.js @@ -2,6 +2,7 @@ import { Item, Tabs } from "./components/Tabs"; import Details from "./components/Details"; import fs from "fs"; import matter from 'gray-matter' +import Link from "next/link"; const path = require('path'); const POSTS_PATH = process.cwd(); var filenames = fs.readdirSync(POSTS_PATH); @@ -75,8 +76,8 @@ export default function Home() {
{ month2Posts[month].map(({slug, tags}) => ( -
- {slug} +
+ {slug} { tags && tags.length > 0 &&
{ tags.map(tag => (