File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { Layout } from '../layout'
77import { PostPreview } from '../components/post-preview'
88import Seo from '../components/seo'
99import SubscriptionForm from '../components/subscription-form'
10+ import { Labels } from '../components/labels'
1011
1112const List = styled . ul `
1213 list-style: none;
@@ -17,7 +18,16 @@ const Index = ({ data }) => (
1718 < Layout >
1819 < Seo />
1920 < Centralise >
20- < h1 itemProp = 'name headline' > Recent Posts</ h1 >
21+ < div >
22+ < h2 > Top Tags</ h2 >
23+ < Labels
24+ from = { data . tagsGroup . group
25+ . sort ( ( a , b ) => b . totalCount - a . totalCount )
26+ . slice ( 0 , 5 )
27+ . map ( ( tag ) => tag . fieldValue ) }
28+ />
29+ </ div >
30+ < h2 itemProp = 'name headline' > Recent Posts</ h2 >
2131 < List itemScope itemType = 'https://schema.org/ItemList' >
2232 { data . allMarkdownRemark . edges . map ( ( { node } , i ) => (
2333 < li
@@ -56,5 +66,11 @@ export const query = graphql`
5666 }
5767 }
5868 }
69+ tagsGroup: allMarkdownRemark {
70+ group(field: frontmatter___tags) {
71+ fieldValue
72+ totalCount
73+ }
74+ }
5975 }
6076`
You can’t perform that action at this time.
0 commit comments