Update posts by tag, fix ul styling

This commit is contained in:
Cassidy Williams committed 2023-01-26 23:40:45 -06:00
1 parent a9097ab84f
commit 77d762b196
8 files changed
+59 -36

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
export default function getTags(posts) {
// Get tags from all posts
const allTags = posts
.map((post) => {
const postTags = post.frontmatter.tags;
let allTags = [];
if (postTags.length > 0) {
postTags.forEach((tag) => {
if (allTags.indexOf(tag) === -1) {
allTags.push(tag);
}
});
}
return allTags;
})
.flat(1);
// Make the tags unique
let tags = [...new Set(allTags)];
return tags;
}