File tree Expand file tree Collapse file tree 1 file changed +22
-5
lines changed
Expand file tree Collapse file tree 1 file changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ if (home.length > 0) {
2121 homeGithubCalendar = homeEntry .data .githubCalendar
2222}
2323const sortedPosts = await getSortedPosts ()
24+ const postsHaveTags = sortedPosts .some (
25+ (post ) => post .data .tags && post .data .tags .length > 0 ,
26+ )
2427---
2528
2629<Layout >
@@ -31,11 +34,25 @@ const sortedPosts = await getSortedPosts()
3134 </HomeBanner >
3235 )
3336 }
34- <BlockHeader >Tags</BlockHeader >
35- <TagsSection posts ={ sortedPosts } />
36- <BlockHeader >Latest Posts</BlockHeader >
37- { sortedPosts .slice (0 , siteConfig .pageSize ).map ((post ) => <PostPreview post = { post } />)}
38- <Pagination nextLink =" /posts" nextText =" Archive" />
37+ {
38+ postsHaveTags && (
39+ <>
40+ <BlockHeader >Tags</BlockHeader >
41+ <TagsSection posts = { sortedPosts } />
42+ </>
43+ )
44+ }
45+ {
46+ sortedPosts .length > 0 && (
47+ <>
48+ <BlockHeader >Latest Posts</BlockHeader >
49+ { sortedPosts .slice (0 , siteConfig .pageSize ).map ((post ) => (
50+ <PostPreview post = { post } />
51+ ))}
52+ <Pagination nextLink = " /posts" nextText = " Archive" />
53+ </>
54+ )
55+ }
3956</Layout >
4057
4158<style is:global >
You can’t perform that action at this time.
0 commit comments