mirror of
https://github.com/KazooTTT/kazoottt-blog-v2.git
synced 2025-06-16 23:41:20 +08:00
feat: 首页增加关于我的信息,更新依赖
- 首页增加个人简介和wakatime代码时间 - 更新pnpm版本 - 移除about页面,精简导航栏 - 增加最近更新组件,在归档页展示 - 移除notes的index
This commit is contained in:
@ -68,5 +68,6 @@
|
|||||||
"reading-time": "^1.5.0",
|
"reading-time": "^1.5.0",
|
||||||
"tailwindcss": "4.0.7",
|
"tailwindcss": "4.0.7",
|
||||||
"typescript": "^5.7.3"
|
"typescript": "^5.7.3"
|
||||||
}
|
},
|
||||||
|
"packageManager": "pnpm@10.7.0+sha512.6b865ad4b62a1d9842b61d674a393903b871d9244954f652b8842c2b553c72176b278f64c463e52d40fff8aba385c235c8c9ecf5cc7de4fd78b8bb6d49633ab6"
|
||||||
}
|
}
|
||||||
|
30
src/components/RecentUpdate.astro
Normal file
30
src/components/RecentUpdate.astro
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
import { getAllCollectionPosts } from "@/data/post";
|
||||||
|
import { MAX_LATEST_POSTS } from "@/utils/constant";
|
||||||
|
import { getLatestUpdatedPost } from "@/utils/date";
|
||||||
|
const allPosts = await getAllCollectionPosts();
|
||||||
|
const latestUpdatedPost = allPosts.sort(getLatestUpdatedPost).slice(0, MAX_LATEST_POSTS);
|
||||||
|
---
|
||||||
|
|
||||||
|
{
|
||||||
|
(
|
||||||
|
<div>
|
||||||
|
<h2 class="title mb-4 flex items-center gap-2 text-lg">
|
||||||
|
<a class="">最近更新</a>
|
||||||
|
</h2>
|
||||||
|
<ul class="flex flex-wrap gap-2">
|
||||||
|
{latestUpdatedPost.map((post) => (
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href={`${post.collection === "post" ? "/posts/" : "/notes/"}${post.id}/`}
|
||||||
|
class="hover:text-link"
|
||||||
|
>
|
||||||
|
<span>{post.data.date_modified.toLocaleDateString()}</span>
|
||||||
|
{post.data.title}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
@ -12,6 +12,7 @@ import { collectionDateSort, getLatestUpdatedPost } from "@/utils/date";
|
|||||||
import type { GetStaticPaths, Page } from "astro";
|
import type { GetStaticPaths, Page } from "astro";
|
||||||
import { MAX_TAGS, MAX_CATEGORIES, MAX_POSTS_PER_PAGE, MAX_LATEST_POSTS } from "@/utils/constant";
|
import { MAX_TAGS, MAX_CATEGORIES, MAX_POSTS_PER_PAGE, MAX_LATEST_POSTS } from "@/utils/constant";
|
||||||
import type { AllItem } from "@/types";
|
import type { AllItem } from "@/types";
|
||||||
|
import RecentUpdate from "@/components/RecentUpdate.astro";
|
||||||
|
|
||||||
export const getStaticPaths = (async ({ paginate }) => {
|
export const getStaticPaths = (async ({ paginate }) => {
|
||||||
const allPosts = await getAllCollectionPosts();
|
const allPosts = await getAllCollectionPosts();
|
||||||
@ -33,7 +34,7 @@ interface Props {
|
|||||||
latestUpdatedPost: AllItem[];
|
latestUpdatedPost: AllItem[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const { page, postsCount, latestUpdatedPost } = Astro.props;
|
const { page, postsCount } = Astro.props;
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
description: "Read my collection of posts and the things that interest me",
|
description: "Read my collection of posts and the things that interest me",
|
||||||
@ -85,28 +86,7 @@ const descYearKeys = Object.keys(groupedByYear).sort((a, b) => +b - +a);
|
|||||||
<Pagination {...paginationProps} />
|
<Pagination {...paginationProps} />
|
||||||
</div>
|
</div>
|
||||||
<aside class="flex flex-col gap-8">
|
<aside class="flex flex-col gap-8">
|
||||||
{
|
<RecentUpdate />
|
||||||
(
|
|
||||||
<div>
|
|
||||||
<h2 class="title mb-4 flex items-center gap-2 text-lg">
|
|
||||||
<a class="">最近更新</a>
|
|
||||||
</h2>
|
|
||||||
<ul class="flex flex-wrap gap-2">
|
|
||||||
{latestUpdatedPost.map((post) => (
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href={`${post.collection === "post" ? "/posts/" : "/notes/"}${post.id}/`}
|
|
||||||
class="hover:text-link"
|
|
||||||
>
|
|
||||||
<span>{post.data.date_modified.toLocaleDateString()}</span>
|
|
||||||
{post.data.title}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</aside>
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
</PageLayout>
|
</PageLayout>
|
||||||
|
@ -6,6 +6,9 @@ import { getAllFixedToTopPosts, getAllNotes, getAllPosts } from "@/data/post";
|
|||||||
import PageLayout from "@/layouts/Base.astro";
|
import PageLayout from "@/layouts/Base.astro";
|
||||||
import { collectionDateSort } from "@/utils/date";
|
import { collectionDateSort } from "@/utils/date";
|
||||||
import SelfIntro from "@/pages/self-intro.astro";
|
import SelfIntro from "@/pages/self-intro.astro";
|
||||||
|
import ContentFooter from "@/components/ContentFooter.astro";
|
||||||
|
import GiscusComment from "@/components/componentsBefore/GiscusComment";
|
||||||
|
import Tools from "@/components/tools/index.astro";
|
||||||
|
|
||||||
// Posts
|
// Posts
|
||||||
const MAX_POSTS = 10;
|
const MAX_POSTS = 10;
|
||||||
@ -24,9 +27,22 @@ const latestNotes = allNotes.sort(collectionDateSort).slice(0, MAX_NOTES);
|
|||||||
|
|
||||||
<PageLayout meta={{ title: "Home" }}>
|
<PageLayout meta={{ title: "Home" }}>
|
||||||
<section>
|
<section>
|
||||||
<h1 class="title mb-6">Hello World!</h1>
|
<div class="">
|
||||||
|
<h1 class="title mb-6">About</h1>
|
||||||
<SelfIntro />
|
<SelfIntro />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="my-2">
|
||||||
|
<a href="https://wakatime.com/@d3dc2570-e4bf-4469-b0c2-127b495e8b91"
|
||||||
|
><img
|
||||||
|
src="https://wakatime.com/badge/user/d3dc2570-e4bf-4469-b0c2-127b495e8b91.svg"
|
||||||
|
alt="Total time coded since Nov 4 2017"
|
||||||
|
/></a
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
<SocialList />
|
<SocialList />
|
||||||
|
<Tools enableCollapse={true} defaultOpen={false} />
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -74,4 +90,6 @@ const latestNotes = allNotes.sort(collectionDateSort).slice(0, MAX_NOTES);
|
|||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
<ContentFooter />
|
||||||
|
<GiscusComment client:load />
|
||||||
</PageLayout>
|
</PageLayout>
|
||||||
|
@ -62,17 +62,7 @@ function calculateIndex(index: number, page: Page<NoteItem>) {
|
|||||||
<div class="flex-1"></div>
|
<div class="flex-1"></div>
|
||||||
</h1>
|
</h1>
|
||||||
<div class="columns-1">
|
<div class="columns-1">
|
||||||
{
|
{page.data.map((note) => <Note note={note} as="h2" isPreview enableLineClamp={false} />)}
|
||||||
page.data.map((note, index) => (
|
|
||||||
<Note
|
|
||||||
note={note}
|
|
||||||
as="h2"
|
|
||||||
isPreview
|
|
||||||
index={calculateIndex(index, page)}
|
|
||||||
enableLineClamp={false}
|
|
||||||
/>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
<Pagination {...paginationProps} />
|
<Pagination {...paginationProps} />
|
||||||
</section>
|
</section>
|
||||||
|
@ -6,6 +6,4 @@
|
|||||||
<p>4年经验的前端开发工程师</p>
|
<p>4年经验的前端开发工程师</p>
|
||||||
<p>主要使用react + vite + typescript开发</p>
|
<p>主要使用react + vite + typescript开发</p>
|
||||||
<p>喜欢写一些自己的side project</p>
|
<p>喜欢写一些自己的side project</p>
|
||||||
<p>三分钟热度,还在寻找自己真正的热爱</p>
|
|
||||||
<p><a href="https://lyrics.kazoottt.top/">我的歌词本</a></p>
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -37,10 +37,10 @@ export const menuLinks: { path: string; title: string }[] = [
|
|||||||
path: "/",
|
path: "/",
|
||||||
title: "Home",
|
title: "Home",
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
path: "/about/",
|
// path: "/about/",
|
||||||
title: "About",
|
// title: "About",
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
path: "/posts/",
|
path: "/posts/",
|
||||||
title: "Blog",
|
title: "Blog",
|
||||||
@ -49,10 +49,6 @@ export const menuLinks: { path: string; title: string }[] = [
|
|||||||
path: "/notes/",
|
path: "/notes/",
|
||||||
title: "Notes",
|
title: "Notes",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: "/archive/",
|
|
||||||
title: "Archive",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "/friends/",
|
path: "/friends/",
|
||||||
title: "Friends",
|
title: "Friends",
|
||||||
|
Reference in New Issue
Block a user