@@ -9,24 +9,27 @@ const postCollection = await getCollection('post', ({ data }) => {
99 return import .meta .env .DEV || data .draft !== true ;
1010});
1111
12- const tagCounts = postCollection .reduce <Record <string , number >>((res , post ) => {
13- const postTags = post .data .tags ;
14- if (! postTags || ! postTags .length ) return res ;
15- postTags .forEach (tag => {
16- if (tag .trim () === ' ' ) return ;
12+ const tagCounts = postCollection .reduce <Record <string , number >>(
13+ (res , post ) => {
14+ const postTags = post .data .tags ;
15+ if (! postTags || ! postTags .length ) return res ;
16+ postTags .forEach ((tag ) => {
17+ if (tag .trim () === ' ' ) return ;
1718
18- if (res [tag ]) {
19- res [tag ]++ ;
20- } else {
21- res [tag ] = 1 ;
22- }
23- })
24- return res ;
25- }, {
26- All: postCollection .length
27- })
19+ if (res [tag ]) {
20+ res [tag ]++ ;
21+ } else {
22+ res [tag ] = 1 ;
23+ }
24+ });
25+ return res ;
26+ },
27+ {
28+ All: postCollection .length ,
29+ },
30+ );
2831
29- const tags = Object .keys (tagCounts ).map (tag => ({
32+ const tags = Object .keys (tagCounts ).map (( tag ) => ({
3033 name: tag ,
3134 count: tagCounts [tag ],
3235}));
@@ -80,8 +83,8 @@ const posts = [...postCollection]
8083 {
8184 tags .map (({ name , count }) => (
8285 <li class = " block cursor-pointer rounded-full bg-slate3 px-4 py-2 text-slate10 transition-all hover:bg-slate4 hover:text-slate11" >
83- { name }
84- <sup class = " text-slate8 text- [10px]" >{ count } </sup >
86+ { name }
87+ <sup class = " text-[10px] text-slate8 " >{ count } </sup >
8588 </li >
8689 ))
8790 }
@@ -91,6 +94,6 @@ const posts = [...postCollection]
9194</PageLayout >
9295<style >
9396 .blog-list-item {
94- @apply flex cursor-pointer flex-col justify-between rounded-lg py-2 transition-all active:scale-[0.995] active:bg-slate4 sm:flex-row sm:items-center sm:px-2 sm:hover:bg-slate3;
97+ @apply flex cursor-pointer flex-col justify-between rounded-lg py-2.5 transition-all active:scale-[0.995] active:bg-slate4 sm:flex-row sm:items-center sm:px-2 sm:hover:bg-slate3;
9598 }
9699</style >
0 commit comments