mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
9 lines
316 B
TypeScript
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;
|