Pursuit of Loot

Tags, part 3

Posted on 23rd January 2020

Yesterday, you may have read about the next piece of work I did on the site regarding tags, well today I'm pleased to say I have finalised this work with the addition of a tag cloud!

It didn't take much work to be honest, I just googled react tag cloud, found the first package on npm and installed it, then followed the instructions to add the component to my page.

I had to create a small function to map my existing markdown query data into the object formatting that the plugin required, but this was easy enough...

const formatTagsForComponent = tags => {
return tags.map(tag => {
return {
value: tag.tag,
count: tag.totalCount
};
});
};

Head over to the tags page to see it in action.


Enjoyed this post? Feel free to share it with your audience using the links below:

Don't see your favourite social network on the list? Feel free to let me know and I'll get it added.

Comments

©2022 Pursuit of Loot. All rights reserved.