File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ interface Props {
1111}
1212
1313const category = Astro .params .category
14+ const categoryName = getCategoryName (category ?.toString () ?? ' ' )
1415
1516export const getStaticPaths: GetStaticPaths = async () => {
1617 const posts = await getPosts ()
@@ -25,7 +26,7 @@ export const getStaticPaths: GetStaticPaths = async () => {
2526}
2627---
2728
28- <ContentLayout title ={ ` 分类 - ${getCategoryName ( category ?. toString () ?? ' ' ) } ` } >
29- <h1 >分类 - { category } </h1 >
29+ <ContentLayout title ={ ` 分类 - ${categoryName } ` } >
30+ <h1 >分类 - { categoryName } </h1 >
3031 <PostList posts ={ Astro .props .posts } />
3132</ContentLayout >
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import ContentLayout from '@/layouts/ContentLayout.astro'
33import { getPosts , getTags , getCategories } from ' @/utils/post'
44import { Shapes , Tags } from ' lucide-react'
55import PostList from ' @/components/common/PostList.astro'
6+ import { getCategoryName } from ' @/utils/names'
67
78const posts = await getPosts ()
89const tags = getTags (posts )
@@ -32,7 +33,7 @@ const categories = getCategories(posts)
3233 categories .map (([category , count ]) => (
3334 <span class = " inline-block" >
3435 <a href = { ` /categories/${category } ` } >
35- { category }
36+ { getCategoryName ( category ) }
3637 <span class = " text-xs" >{ count } </span >
3738 </a >
3839 </span >
You can’t perform that action at this time.
0 commit comments