Create getPostsByTag util function

This commit is contained in:
Sat Naing
2022-09-11 16:39:37 +06:30
parent 22f21782da
commit 30bf56ccf8
+8
View File
@@ -0,0 +1,8 @@
import type { MarkdownInstance } from "astro";
import { slufigyAll } from "./slugify";
import type { Frontmatter } from "./types";
const getPostsByTag = (posts: MarkdownInstance<Frontmatter>[], tag: string) =>
posts.filter((post) => slufigyAll(post.frontmatter.tags).includes(tag));
export default getPostsByTag;