mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-25 20:27:44 +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 fs from "node:fs";
|
||||||
import matter from "gray-matter";
|
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
|
import matter from "gray-matter";
|
||||||
|
|
||||||
const postsDirectory = join(process.cwd(), "src", "posts");
|
const postsDirectory = join(process.cwd(), "src", "posts");
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ export function getPostBySlug(slug: string, fields: string[] = []) {
|
||||||
const items: Items = {};
|
const items: Items = {};
|
||||||
|
|
||||||
// Ensure only the minimal needed data is exposed
|
// Ensure only the minimal needed data is exposed
|
||||||
fields.forEach((field) => {
|
for (const field of fields) {
|
||||||
if (field === "slug") {
|
if (field === "slug") {
|
||||||
items[field] = realSlug;
|
items[field] = realSlug;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ export function getPostBySlug(slug: string, fields: string[] = []) {
|
||||||
if (typeof data[field] !== "undefined") {
|
if (typeof data[field] !== "undefined") {
|
||||||
items[field] = data[field];
|
items[field] = data[field];
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue