Files
MyBlog-Next/src/utils/getPostsByTag.ts
T
2022-10-16 23:53:16 +06:30

9 lines
316 B
TypeScript

import { slufigyAll } from "./slugify";
import type { MarkdownInstance } from "astro";
import type { Frontmatter } from "../types";
const getPostsByTag = (posts: MarkdownInstance<Frontmatter>[], tag: string) =>
posts.filter(post => slufigyAll(post.frontmatter.tags).includes(tag));
export default getPostsByTag;