mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
Add filter for draft posts
This commit is contained in:
@@ -13,12 +13,14 @@ localStorage.setItem("myCat", "Tom");
|
|||||||
const posts = await Astro.glob<Frontmatter>("../contents/*.md");
|
const posts = await Astro.glob<Frontmatter>("../contents/*.md");
|
||||||
|
|
||||||
// List of items to search in
|
// List of items to search in
|
||||||
const searchList = posts.map(({ frontmatter }) => ({
|
const searchList = posts
|
||||||
|
.filter(({ frontmatter }) => !frontmatter.draft)
|
||||||
|
.map(({ frontmatter }) => ({
|
||||||
title: frontmatter.title,
|
title: frontmatter.title,
|
||||||
description: frontmatter.description,
|
description: frontmatter.description,
|
||||||
frontmatter,
|
frontmatter,
|
||||||
slug: frontmatter.slug,
|
slug: frontmatter.slug,
|
||||||
}));
|
}));
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title={`Search | ${SITE.title}`}>
|
<Layout title={`Search | ${SITE.title}`}>
|
||||||
|
|||||||
Reference in New Issue
Block a user