Update posts by tag, fix ul styling

This commit is contained in:
Cassidy Williams
2023-01-26 23:40:45 -06:00
parent a9097ab84f
commit 77d762b196
8 changed files with 59 additions and 36 deletions

23
src/scripts/getTags.js Normal file
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;
}