Skip to content

Commit e40be9c

Browse files
authored
chore: performance improve, fix minor aria and disaplay bugs (#90)
Chore: - Remove `thumbnailAbout` and `thumbnailFriends` options from config, enable `showThumbnail` option for frontmatter for each page to use. - Change all icons to use `fa6` instead of others to reduce bundling size. - Remove not-exist prop `onLinkClick` from `useTOCLogic` hook. Fix: - Aria issue with TOC, use `menu` instead of `nav`. Use `ul` + `li` instead of `div`. - TOC link switch to barebone `<a>` tag instead of nextjs `Link` components to avoid prefetch cost performance. - Auto slug activate may exceed viewport and not centered even possible. Deps: - Upgrade nextjs to `15.1.0` - Remove `engine` part since controlled by `packageManager` and `node-version`
1 parent cba3a96 commit e40be9c

File tree

15 files changed

+133
-121
lines changed

15 files changed

+133
-121
lines changed

config.yml

+1-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: 'Suzu is a minimalist blog template with a serene sakura-inspired t
77
keywords: 'Suzu, Next.js, markdown blog, Tailwind CSS, blog template, sakura, ZL Asica' # Comma-separated keywords for SEO purposes.
88
author:
99
name: 'ZL Asica' # Your name, displayed as the author of the blog.
10-
link: 'https://www.zla.app' # Link to your personal website or blog.
10+
link: 'https://www.zla.pub' # Link to your personal website or blog.
1111
# Language setting: Use ISO 639-1 code (e.g., 'en' for English, 'zh' for Chinese)
1212
lang: 'zh'
1313
# Your public root url, used for SEO and meta tags.
@@ -65,13 +65,6 @@ socialMedia:
6565
email: [email protected] # Your email address.
6666
rss: true # Display the RSS icon.
6767

68-
#######################
69-
# PAGES (ABOUT, FRIENDS) SETTINGS
70-
#######################
71-
# Have thumbnails for the about and friends pages.
72-
thumbnailAbout: false
73-
thumbnailFriends: false
74-
7568
#######################
7669
# COMMENTS SETTINGS
7770
# Only one of the following two options should be enabled.

next-env.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
5+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

package.json

+3-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"funding": "https://github.com/sponsors/ZL-Asica",
1717
"scripts": {
1818
"dev": "next dev --turbopack",
19-
"build": "next build",
19+
"build": "NODE_NO_WARNINGS=1 next build",
2020
"start": "next start",
2121
"format": "prettier --write .",
2222
"lint": "next lint",
@@ -31,7 +31,7 @@
3131
"es-toolkit": "^1.29.0",
3232
"gray-matter": "^4.0.3",
3333
"katex": "^0.16.15",
34-
"next": "15.0.4",
34+
"next": "15.1.0",
3535
"react": "19.0.0",
3636
"react-dom": "19.0.0",
3737
"react-icons": "^5.4.0",
@@ -47,7 +47,7 @@
4747
"yaml": "^2.6.1"
4848
},
4949
"devDependencies": {
50-
"@next/eslint-plugin-next": "^15.0.4",
50+
"@next/eslint-plugin-next": "^15.1.0",
5151
"@tailwindcss/typography": "^0.5.15",
5252
"@types/node": "^22.10.1",
5353
"@types/react": "^19.0.1",
@@ -77,10 +77,6 @@
7777
"prettier --write"
7878
]
7979
},
80-
"engines": {
81-
"node": ">=20",
82-
"pnpm": ">=9"
83-
},
8480
"browserslist": {
8581
"production": [
8682
">0.5%",

pnpm-lock.yaml

+58-58
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

posts/_pages/About.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: '' # (Optional) Default is About
33
thumbnail: '' # (Optional) You can put your personal about thumbnail
44
showComments: false # Set whether you want have comment for this page
55
showLicense: false # Set whether you want to show license for this page
6+
showThumbnail: false # Whether you want to show 'in page' thumbnail.
67
---
78

89
## 自我介绍

posts/_pages/Friends.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: Some Customized Title # (Optional) Default is Friends
33
thumbnail: '' # (Optional) You can put your personal about thumbnail
44
showComments: true # Set whether you want have comment for this page
55
showLicense: false # Set whether you want to show license for this page
6+
showThumbnail: false # Whether you want to show 'in page' thumbnail.
67
---
78

89
## 我的项目

src/app/about/page.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ async function AboutPage() {
6464
<ArticlePage
6565
config={config}
6666
post={post}
67-
showThumbnail={config.thumbnailAbout}
6867
/>
6968
</>
7069
);

src/app/friends/page.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ async function FriendsPage() {
6666
<ArticlePage
6767
config={config}
6868
post={post}
69-
showThumbnail={config.thumbnailFriends}
7069
/>
7170
</>
7271
);

src/components/article/ArticlePage.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@ const DisqusComments = dynamic(() =>
2121
interface PostLayoutProperties {
2222
config: Config;
2323
post: FullPostData;
24-
showThumbnail?: boolean;
2524
}
2625

27-
const ArticlePage = ({ config, post, showThumbnail = true }: PostLayoutProperties) => {
26+
const ArticlePage = ({ config, post }: PostLayoutProperties) => {
2827
const translation = config.translation;
2928

3029
return (
3130
<article className='container mx-auto animate-fadeInDown p-6 pb-2'>
32-
{showThumbnail ? (
31+
{post.frontmatter.showThumbnail ? (
3332
<Thumbnail
3433
title={post.frontmatter.title}
3534
src={post.frontmatter.thumbnail}
@@ -69,7 +68,7 @@ const ArticlePage = ({ config, post, showThumbnail = true }: PostLayoutPropertie
6968
items={post.toc}
7069
translation={translation}
7170
autoSlug={post.frontmatter.autoSlug}
72-
showThumbnail={showThumbnail}
71+
showThumbnail={post.frontmatter.showThumbnail}
7372
/>
7473
)}
7574
<MarkdownContent

0 commit comments

Comments
 (0)