mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-24 11:47:24 +02:00
More fixes
This commit is contained in:
parent
1a5b2f206d
commit
c9f6b67cbf
1 changed files with 3 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
import fs from "node:fs";
|
||||
import matter from "gray-matter";
|
||||
import { join } from "node:path";
|
||||
import matter from "gray-matter";
|
||||
|
||||
const postsDirectory = join(process.cwd(), "src", "posts");
|
||||
|
||||
|
@ -21,7 +21,7 @@ export function getPostBySlug(slug: string, fields: string[] = []) {
|
|||
const items: Items = {};
|
||||
|
||||
// Ensure only the minimal needed data is exposed
|
||||
fields.forEach((field) => {
|
||||
for (const field of fields) {
|
||||
if (field === "slug") {
|
||||
items[field] = realSlug;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ export function getPostBySlug(slug: string, fields: string[] = []) {
|
|||
if (typeof data[field] !== "undefined") {
|
||||
items[field] = data[field];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue