fix(website): respect draft frontmatter field when filtering posts

Posts with `draft: true` in frontmatter were shown because isDraft only
checked the file path for `/drafts/`. Now checks both path and frontmatter.
This commit is contained in:
Mohamed Boudra
2026-03-29 20:39:03 +07:00
parent 096417d5ac
commit a1761363fa
+2 -2
View File
@@ -40,10 +40,10 @@ function loadPosts(includeDrafts: boolean): Post[] {
const posts: Post[] = [];
for (const [path, raw] of Object.entries(postModules)) {
const isDraft = path.includes("/drafts/");
const { data, content } = parseFrontmatter(raw);
const isDraft = path.includes("/drafts/") || data.draft === "true";
if (isDraft && !includeDrafts) continue;
const { data, content } = parseFrontmatter(raw);
const fileName = path.split("/").pop()!.replace(".md", "");
const slug = isDraft ? `drafts/${fileName}` : fileName;