import { cache, reader } from '@/lib/readers/base';

export const getMetaPosts = cache(async () =>
  reader.collections['meta_posts'].all()
);

export const getMetaPostBySlug = cache(async (slug: string) => {
  const article = await reader.collections['meta_posts'].read(slug);
  return article ? { ...article, slug } : null;
});

export const getMetaHome = cache(async () => {
  const article = await reader.collections['meta_posts'].read('index');
  return article ? { ...article } : null;
});
